-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Methods overwrite current transformation #38
Comments
Yes this is expected. You should use the el.transform('matrix', '1,0,0,-1,0,0') Transform values are numerically stored in order to be able to animate them. Or rather, not having to parse them over and over again. That is why all transformation should be applied through the The example above can also be achieved like this: el.transform({ d: -1 }) As in |
Right. So if I want to apply a el.transform({ d: -1 });
//Other stuff happens, time passes
el.transform({ e: el.transform().x + 100 }); (e meaning the |
Well, not exactly. Translations and matrices are applied separately. In other words, transformations are not combined into a matrix. If you move an element with: rect.transform({ x: 100, y: 50 }) The value of the transform attribute will be If you add a matrix transformation afterwards, let's say: rect.transform({ d: -1 }) The value of the transform attribute will be Transformations are combined in svg. Recalculating transformations into a singular matrix would remove that. To be honest, I have been thinking about going that way (one matrix to rule them all). But I decided to stay as close as possible to SVG's native behaviour. |
Are you with me on this? |
Yeah. Perhaps adding extra utility methods that translate, scale, etc. On the other hand, I would always expect that svg.js takes the most On Friday, May 24, 2013, Wout Fierens wrote:
|
Let's say I have the following code:
The node of this object has now the attribute
transform="matrix(1,0,0,-1,0,0)"
.If I now try move the element:
It resets all previous transformations, and its node transform attribute looks like
transform="translate(0,100)"
.Is that expected? Right now the only way to wor around this behavior is doing something like this:
The text was updated successfully, but these errors were encountered: