Comments (8)
Not directly no. Currently we're rocking this function which only takes a transformObject so far.
I've explained before in great detail why only this implementation, but in short it's not worth your time to mess with that.
from svg-path-commander.
it's not worth your time to mess with that.
I'm not sure I have a choice unfortunately, I need to collapse an svg into a single path, but this svg could have groups applying matrix transformations to various parts of it, so I need to resolve those.
from svg-path-commander.
We might find an algorithm to merge paths into one, I'm sure, just I don't have the time right now.
However you can make use of the online demo to transform each path by its transform and/or its group transform, find a pattern and make an algorithm, I can try and help with that.
from svg-path-commander.
Thanks, for now I'm just using svg-path-commander
, for it's ability to set the origin of a transformation, and svgpath
, for its ability to apply a matrix transformation. Ideally I'd have just one dependency for manipulating paths, but it's good enough I guess.
from svg-path-commander.
If you only need to transfer the transformation from the transform
attribute into the path commands, we only need a parser, then the algorithm is straight forward.
from svg-path-commander.
A parser for the value of the attribute? something like value.slice(7, -1).split(',').map(Number)
? (assuming it's a matrix, but it should be simple enough to handle all the other options)
Could you point me to what the algorithm is? I've seen different ones, none worked with same as svgpath
for me, maybe I'm missing something 🤔
from svg-path-commander.
In short, I'm thinking:
- parse transform string from
<path>
s - parse transform string from parent
<g>
groups - apply the transformation to path in a specific order (I'm thinking parent groups first, EG parent G -> parent G -> path)
- remove the transform attribute from all in the tree
- repeat for every path
Does this sound complicated?
from svg-path-commander.
Closed due to no activity.
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
- 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.