Git Product home page Git Product logo

Comments (18)

VisualFox avatar VisualFox commented on June 11, 2024 1

@thednp That perfect! Thank you!

from svg-path-commander.

thednp avatar thednp commented on June 11, 2024

I'm not really sure how to handle this issue, can you please suggest a possible fix?

from svg-path-commander.

VisualFox avatar VisualFox commented on June 11, 2024

I don't think that a bug per se. You just need to manually install and require the 'dommatrix' module before requiring 'svg-path-commander'. Maybe update the documentation?

npm install dommatrix --save

const DOMMatrix = require('dommatrix'); //for node.js
const SVGPathCommander = require('svg-path-commander');

console.log(new SVGPathCommander('M0 0l50 0l50 50z'));

from svg-path-commander.

thednp avatar thednp commented on June 11, 2024

@VisualFox thank you for your input. Please check the updated README and feel free to bring more clarity to it.

Thanks

from svg-path-commander.

d-eisenga avatar d-eisenga commented on June 11, 2024

Thanks for the suggestion, but I still get the same error even when manually installing and requiring dommatrix:

ReferenceError: DOMMatrix is not defined
    at <project-dir>/node_modules/svg-path-commander/dist/svg-path-commander.min.js:2:5648
    at <project-dir>/node_modules/svg-path-commander/dist/svg-path-commander.min.js:2:84
    at Object.<anonymous> (<project-dir>/node_modules/svg-path-commander/dist/svg-path-commander.min.js:2:211)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (<project-dir>/index.js:5:26)

This is on both Node 12 and Node 14. Here's the package.json for my test project:

{
  "name": "svg-test",
  "version": "1.0.0",
  "dependencies": {
    "dommatrix": "0.0.4-d",
    "svg-path-commander": "0.0.9"
  }
}

My index.js is a direct copy-paste from the updated README.

from svg-path-commander.

thednp avatar thednp commented on June 11, 2024

@VisualFox welp?

from svg-path-commander.

VisualFox avatar VisualFox commented on June 11, 2024

@thednp @d-eisenga I will look into that

from svg-path-commander.

thednp avatar thednp commented on June 11, 2024

@VisualFox please check the WIKIs, I moved all documentation related content over there.

from svg-path-commander.

VisualFox avatar VisualFox commented on June 11, 2024

@d-eisenga I found the issue. Requiring dommatrix was not the correct solution and was only working for me for a wrong reason as I tested it inside a Jupyter notebook.

@thednp I am going to send you a PR for fixing this issue.

from svg-path-commander.

thednp avatar thednp commented on June 11, 2024

@VisualFox
Green. Go ahead.

from svg-path-commander.

VisualFox avatar VisualFox commented on June 11, 2024

@thednp Done

from svg-path-commander.

thednp avatar thednp commented on June 11, 2024

Thanks, don't know how I missed that.

from svg-path-commander.

thednp avatar thednp commented on June 11, 2024

@d-eisenga I've published updated code to the clouds, can you please confirm the fix is OK?

Thanks again guys.

from svg-path-commander.

d-eisenga avatar d-eisenga commented on June 11, 2024

After updating I now get a new error:

ReferenceError: feedFromArray is not defined
    at e.setIdentity (<project-dir>/node_modules/svg-path-commander/dist/svg-path-commander.min.js:2:2132)
    at new e (<project-dir>/node_modules/svg-path-commander/dist/svg-path-commander.min.js:2:361)
    at Y (<project-dir>/node_modules/svg-path-commander/dist/svg-path-commander.min.js:2:17398)
    at U (<project-dir>/node_modules/svg-path-commander/dist/svg-path-commander.min.js:2:18335)
    at G.transform (<project-dir>/node_modules/svg-path-commander/dist/svg-path-commander.min.js:2:22065)
    at G.flipX (<project-dir>/node_modules/svg-path-commander/dist/svg-path-commander.min.js:2:22168)
    at Object.<anonymous> (<project-dir>/index.js:14:20)
    at Module._compile (internal/modules/cjs/loader.js:1156:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
    at Module.load (internal/modules/cjs/loader.js:1000:32)

This looks like an issue in the dommatrix library. The issue is that it's trying to access an unnamespaced feedFromArray which does not exist. Instead it should use CSSMatrix.feedFromArray. I fixed it in my local copy of dommatrix but then got the issue that Multiply is not defined, which had the same cause. The same was also true for Translate, and presumably for every other static method of CSSMatrix (like Scale, SkewX/Y/Z, etc) that's used. I might have time to make a PR sometime this week.

from svg-path-commander.

thednp avatar thednp commented on June 11, 2024

Thanks for reporting that.

from svg-path-commander.

thednp avatar thednp commented on June 11, 2024

@d-eisenga can you please test the latest versions (dommatrix and svg-path-commander)?

from svg-path-commander.

d-eisenga avatar d-eisenga commented on June 11, 2024

The latest versions work 😃
I also tried it without manually including dommatrix and it still works, so the Wiki can be updated to remove that line again.

I think I'd like to add automated tests to both libraries, if you don't already have plans to do that. If I do, do you have any preference for testing frameworks?

from svg-path-commander.

thednp avatar thednp commented on June 11, 2024

Most popular should do, however I would like to keep close to d3.js and/or Bootstrap.

Thanks for testing, Wiki updated.

from svg-path-commander.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.