W3C home > Mailing lists > Public > www-svg@w3.org > September 2007

Best way to get the the bbox of an element with respect to its transformations?

From: Jake B <otakuj462@gmail.com>
Date: Mon, 10 Sep 2007 13:42:40 -0400
Message-ID: <8e648abd0709101042ma0bf1c9u22413949615c6a68@mail.gmail.com>
To: www-svg@w3.org
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, I still need to
get the bounding box of the group in terms of the viewport coordinate space.
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:
1)
to make a newer, smarter getBBox method that does take transforms into
account, or

2) to not use translate, instead recursively changing the x,y values
of every member of a group.
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
Received on Monday, 10 September 2007 21:47:21 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 10 December 2014 19:59:27 UTC