Comments (18)
@thednp That perfect! Thank you!
from svg-path-commander.
I'm not really sure how to handle this issue, can you please suggest a possible fix?
from svg-path-commander.
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.
@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.
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.
@VisualFox welp?
from svg-path-commander.
@thednp @d-eisenga I will look into that
from svg-path-commander.
@VisualFox please check the WIKIs, I moved all documentation related content over there.
from svg-path-commander.
@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.
@VisualFox
Green. Go ahead.
from svg-path-commander.
@thednp Done
from svg-path-commander.
Thanks, don't know how I missed that.
from svg-path-commander.
@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.
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.
Thanks for reporting that.
from svg-path-commander.
@d-eisenga can you please test the latest versions (dommatrix
and svg-path-commander
)?
from svg-path-commander.
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.
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)
- Code Review HOT 6
- Unsupported implicit `lineTo` when using additional `moveTo` parameters HOT 6
- Transforms on g elements HOT 9
- path2Curve produces wrong result when converting L command HOT 8
- Support custom `document` on `shapeToPath`
- How to apply 4x4 matrix using SVG path commander HOT 2
- Subdividing paths/curves? HOT 2
- Scale transform doesn't take into consideration the origin property HOT 5
- README logo is hard to see in dark mode HOT 3
- About the lineToCubic algorithm. HOT 2
- Unable to import and use default export in vite/sveltekit HOT 6
- shapeToPath can't infer RectAttr type as param HOT 4
- can shapeToPath return a PathArray or SVGPathCommander? HOT 3
- support native DOMMatrix and/or CSSMatrix for transform HOT 2
- default origin documentation HOT 2
- getSVGMatrix not exposed HOT 2
- Apply a matrix transform to a path HOT 8
- Transformation of the path containing the arch HOT 1
- create path from stroked shape/path HOT 2
- toRelative does not convert absolute moveTo commands in additional segments HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from svg-path-commander.