Skip to content

Take into account of parent transforms #940

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

Closed
wants to merge 12 commits into from

Conversation

Happypig375
Copy link

No description provided.

@Happypig375
Copy link
Author

@mrbean-bremen Re-run?

@H1Gdev
Copy link
Contributor

H1Gdev commented Jan 20, 2022

What kind of SVG will this PR improve ?

@Happypig375
Copy link
Author

@H1Gdev

<svg viewBox="0 0 100 100">
  <text transform="translate(10 30)">
    <tspan id="target">ABC</tspan>
  </text>
</svg>

Bounds of tspan from view box should match text

@H1Gdev
Copy link
Contributor

H1Gdev commented Jan 20, 2022

Thanks.

What happens with this SVG ?

<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="100" height="100">
  <text>
    <tspan transform="translate(10 30)">ABC</tspan>
  </text>
</svg>

Many major browsers don't show anything for this SVG. (transform in <tspan> seems to be ignored.)

@Happypig375
Copy link
Author

Happypig375 commented Jan 20, 2022

<tspan> doesn't support transforms by itself, correct. But its bounds should use its parent transforms to result in the same bounds for the <text> and <tspan> elements since they do represent the same text at the same location.

@H1Gdev
Copy link
Contributor

H1Gdev commented Jan 20, 2022

It doesn't seem to work properly with latest master, can it be fixed by merging this PR ?

@Happypig375
Copy link
Author

Yes, this is what I aim to fix.

@H1Gdev
Copy link
Contributor

H1Gdev commented Jan 22, 2022

It doesn't seem to be fixed...
This SVG should not show anything because <tspan> transform is invalid.

@Happypig375
Copy link
Author

In this case, it's the problem of the parser, and Bounds just takes information from the object tree. Out of scope.

@Happypig375
Copy link
Author

<svg viewBox="0 0 100 100">
  <text transform="translate(10 30)">
    <tspan id="target">ABC</tspan>
  </text>
</svg>

This PR fixes this, and this only.

@Happypig375
Copy link
Author

Hmm, actually this issue may exist across different element types, not just <tspan>.

@Happypig375
Copy link
Author

Superceded by #945

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

Successfully merging this pull request may close these issues.

2 participants