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
[css-transforms-2][svg11] Effect of perspective and 3D transform on SVG bounding box #907
Comments
Possible resolution here: https://lists.w3.org/Archives/Public/public-fx/2013OctDec/0057.html
I don't know if this was discussed at any SVG meeting. |
It was discussed in: https://www.w3.org/2013/10/17-svg-minutes.html#item02 |
To clarify, this is about the bounding box of a parent element to the one that has a transform. (The bounding box of the transformed element itself is always returned relative to its own coordinate system, so the transform doesn't change the numbers.) First issue: The algorithm in SVG 2 doesn't mention child transforms at all! SVG 1.1 didn't have an explicit algorithm or instructions for how to handle child transforms, it just says to contain all the child graphics:
So, this is really undefined behavior on the SVG spec. Let's look at what browsers are doing… I put together a test case: https://codepen.io/AmeliaBR/pen/bJawWW?editors=1011 Five groups, each containing a rectangle. The rectangles are identical prior to the following transforms being added:
The script prints to the console the transform, the rectangle's bounding box, and then the groups bounding box. Results:
My conclusions:
Another thought: SVG 2 adds a bunch of options to |
https://www.w3.org/mid/B7126E1C-EB7C-4D9F-9238-F9CDD72BDB21@adobe.com
SVG defines the bounding box of an object as follows [1]:
""
getBBox(): Returns the tight bounding box in current user space (i.e., after application of the ‘transform’attribute, if any) on the geometry of all contained graphics elements
""
The question is what is the effect of 3D transforms on the bounding box? I assume that there wouldn't be a big difference. It would still be the tight bounding box of the contained elements after transformations.
More interesting, what is with a perspective projection matrix? Would it affect the bounding box as well? After all, the perspective projection matrix is not very different from a CSS transform which can have perspective values as well. Therefore, I would assume that all the properties: transform, transform-origin, perspective and perspective-origin have an effect on the object bounding box.
The text was updated successfully, but these errors were encountered: