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

Computing the equivalent transform of an SVG viewport #951

Open
letochagone opened this issue Aug 2, 2024 · 0 comments
Open

Computing the equivalent transform of an SVG viewport #951

letochagone opened this issue Aug 2, 2024 · 0 comments

Comments

@letochagone
Copy link

letochagone commented Aug 2, 2024

8.2. Computing the equivalent transform of an SVG viewport
I'm trying to understand the viewBox mechanism, by taking a very simple example and applying the process described in the chapter above.
I asked the question stackoverflow illustrating it with an example.

it seems to me that this page is more dedicated to the errors encountered, but I still try to ask my question: where did I go wrong in computing the equivalent ?

I think this chapter 8.2 is missing an example to help with understanding.

( I'm terribly slow to understand but maybe I'm not the only one :) )

UPDATE : I found the cause of my error

the transform attribute should be put in the circle element and not in the svg element

<svg width="100" height="100" > <circle r="50" transform="translate(25 0) scale(1 1)" /> </svg>

<svg width="100" height="100" viewBox="0 0 50 100"> <circle r="50" /> </svg>

https://www.w3.org/TR/SVG/coords.html#ComputingAViewportsTransform
This process converts the min-x, min-y, width and height values of a viewBox attribute, the position and size of the element on which the viewBox attribute is defined, and the value of the preserveAspectRatio attribute on that element into a translation and a scale that is applied to content contained by the element.

I would like to suggest that an example be added in the specification

in fact, there are many sites on svg, which talk about the viewBox, but only on examples. I think examples are fundamental when they follow the theory, but not when (like all these sites) you have to guess the theory from them

merci !

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