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 14:47:47 -0400
Message-ID: <8e648abd0709101147ref87f8g2efd1c16e60959b8@mail.gmail.com>
To: www-svg@w3.org
Hi, I tried sending this message earlier without being subscribed to the
mailing list, and I don't think it went through. My apologies if you're
receiving this twice...

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:
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.

Received on Monday, 10 September 2007 21:47:21 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 March 2017 09:47:11 UTC