Skip to content
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

Parsing of rotate transformation without cx and cy #3

Open
Mincka opened this issue Oct 7, 2014 · 0 comments
Open

Parsing of rotate transformation without cx and cy #3

Mincka opened this issue Oct 7, 2014 · 0 comments

Comments

@Mincka
Copy link

Mincka commented Oct 7, 2014

I'm using the svg.import.js module which now relies on svg.parser.js.

When importing raw SVG with elements that have a rotate transformation without the optionnal cx and cy parameters, svg.import.js will add them based on SVG.defaults.trans().

Example:
<rect transform="rotate(-7.5)" y="1326.0929967499997" x="1281.2933475" height="15" width="15" id="B-1-263-6">
will become the following after the parsing:
<rect id="B-1-263-6" width="15" height="15" y="1326.0929967499997" x="1281.2933475" transform="rotate(-7.5 1288.79296875 1333.59375)">

In this case, the rotation center is near the element position instead of being based on the origin (0,0).

If optional parameters and are not supplied, the rotate is about the origin of the current user > coordinate system. The operation corresponds to the matrix [cos(a) sin(a) -sin(a) cos(a) 0 0].

SVG Tranformations

I think it's better if the parser does not try to add anything here, the spec is valid without cx and cy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant