Jake B
2007-09-10 00:28:25 UTC
Hello, I was wondering, is there was a simple way to calculate the bounding
box of an SVG element with respect to its transformations? The getBBox
method does not seem to take transformations into account.
I'm using the transform attribute because it seems to be the easiest and
most elegant way to translate a group of
elements. However, it is definitely necessary for me
to get the bounding box of the group with respect to its
transformations so that it is locatable within the SVG viewport.
If there is not an easy way to get the bounding box of an element with
respect to its transform, it seems like there are only two alternatives:
to make a newer, smarter getBBox method that does take transforms into
account, or to not use translate, instead recursively changing the
coordinates of every
member of a group and its children. However, neither of these seems like a
very pretty solution, so I am somewhat stuck...
I would greatly appreciate any guidance anyone can provide. Thanks.
Jake
box of an SVG element with respect to its transformations? The getBBox
method does not seem to take transformations into account.
I'm using the transform attribute because it seems to be the easiest and
most elegant way to translate a group of
elements. However, it is definitely necessary for me
to get the bounding box of the group with respect to its
transformations so that it is locatable within the SVG viewport.
If there is not an easy way to get the bounding box of an element with
respect to its transform, it seems like there are only two alternatives:
to make a newer, smarter getBBox method that does take transforms into
account, or to not use translate, instead recursively changing the
coordinates of every
member of a group and its children. However, neither of these seems like a
very pretty solution, so I am somewhat stuck...
I would greatly appreciate any guidance anyone can provide. Thanks.
Jake