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

JAMSVGImage size/viewBox calculation is incorrect. #22

Open
rwe opened this issue Apr 24, 2015 · 0 comments
Open

JAMSVGImage size/viewBox calculation is incorrect. #22

rwe opened this issue Apr 24, 2015 · 0 comments

Comments

@rwe
Copy link
Contributor

rwe commented Apr 24, 2015

While researching the correct fix for #18 , I read through a helpful description of how SVG handles the viewBox attribute here: http://tutorials.jenkov.com/svg/svg-viewport-view-box.html

viewBox defines an internal coordinate system which gets transformed into the parent coordinate system by a combination of width, height, and preserveAspectRatio properties.

JAVSVGParser currently ignores the SVG width and height attributes entirely, which makes the viewBox attribute meaningless when it is not equally sized to width and height. Currently viewBox origin is respected, but its size relative to the SVG width and height is not.

I believe the correct-ish behaviour is, in the SVG handling of JAMSVGParser:

  • Read width and height
  • Read preserveAspectRatio
  • Read viewBox
  • Image size is determined exclusively by width and height.
  • Path transformation is determined by combination of all of those attributes.
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