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

Percentages in <pattern>s are resolved using the wrong viewport #12

Open
Felerius opened this issue Jun 23, 2017 · 0 comments
Open

Percentages in <pattern>s are resolved using the wrong viewport #12

Felerius opened this issue Jun 23, 2017 · 0 comments

Comments

@Felerius
Copy link
Collaborator

Percentages in patterns should be relative to the viewport of the <svg> they are defined in. Right now they are interpreted as relative to the viewport of the referencing shape element.

This could either mean somehow saving the viewport of each <svg> element (but when parsing the <pattern> the <svg> element it is defined in might not have been parsed yet), parsing all patterns in an initial pass (to an intermediate format) and then reference them in a second pass parsing all shape elements.

To test this, use the following svg:

<svg width="100" height="100">
  <defs>
    <pattern id="a" x="0" y="0" width="50%" height="50%" patternUnits="userSpaceOnUse">
      <circle cx="25%" cy="25%" r="25%" stroke="none" fill="blue"/>
    </pattern>
  </defs>
  <rect x="0" y="0" width="50" height="50" stroke="none" fill="url(#a)"/>
  <svg x="50" y="50" width="50" height="50">
    <rect x="0" y="0" width="50" height="50" stroke="none" fill="url(#a)"/>
  </svg>
</svg>

It should show two circles of the same size, and not one big one and a cluster of four small ones.

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