Skip to content

JAMSVGImage size/viewBox calculation is incorrect. #22

Description

@rwe

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions