W3C home > Mailing lists > Public > www-svg@w3.org > May 2014

Bounding box of a group with a transformed child

From: Kari Pihkala <kari.pihkala@gmail.com>
Date: Mon, 26 May 2014 10:57:45 +0300
Message-ID: <CAE0t3MxnxWN2Vb8csxvWknaTbCVAQqY9VjMgGH7KTL5KqTUgrA@mail.gmail.com>
To: www-svg@w3.org

I noticed a difference in bounding box calculation (getBBox()) in
Firefox and Safari and I'm not sure which one is correct.

The document has a rotated ellipse element in a group element:
<g id="e2">
    <ellipse id="e1" rx="50" ry="50" transform="translate(100,100) rotate(45)"/>

The resulting bboxes for e2 are:
Firefox: 50.011 50.011 99.976 99.976
Safari: 29.289 29.289 141.421 141.421

Here's jsfiddle to the doc, so you can see the results.

I read the specs about this and they talk about "tightest fitting
rectangle", so I assume Firefox is correct? The algorithm given in
SVG2 spec doesn't mention how transforms affect the union of child
bounding boxes, so I'm not sure about this.


Received on Monday, 26 May 2014 07:58:14 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:54:53 UTC