dojox.gfx bounding box for Text and Group nodes

The documentation for getBoundingBox() in dojo says:

Returns a bounding box of a shape. A text shape is a point-based object, so it doesn't define a bounding box.

I don't get it. Any sane implementation of vector graphics for the web includes bounding box for text objects (raphaelJS and jQuery SVG that is)! Here, what does "a point based object" mean?

I found no reference for a bounding box for Group object, but when using the latest Dojo version, getBoundingbox returns null for Groups as well

I can easily do bounding box for rectangle myself, but the only really problematic shapes I need bounding box for are the Group and the Text.

I ended hotpatching dojo like:

dojox.gfx.Text.prototype.getBoundingBox = function() { return this.rawNode.getBBox();});
dojox.gfx.Group.prototype.getBoundingBox = function() { return this.rawNode.getBBox();});

Which will of course work only for the SVG output front end.

But I wonder, am I missing something? Is there a better way to do that?


I found no reference for a bounding box for Group object, but when using the latest Dojo version, getBoundingbox returns null for Groups as well

Is this problem related to this bug fix? Sounds like it to me. It was Changed 7 months ago by pruzand and marked as fixed

http://bugs.dojotoolkit.org/ticket/7019

Update 2012-07-24: I downloaded release-1.8.0rc1 locally and setup the same test in the resolved ticket. This indeed has been fixed in 1.8 and getBoundingBox returning null on groups is resolved as stated in the ticket. The test script successfully returns:

bbox of group: {"x":0,"y":2,"endX":238,"endY":379,"width":238,"height":377}
transformed bbox: [{"x":277.7302117816355,"y":152.5448441073243},{"x":512.114456998541,"y":193.87311039205372},{"x":446.64909401810826,"y":565.1456332776561},{"x":212.26484880120276,"y":523.8173669929267}]

Also for what it's worth, according to this twitter post, 1.8 is due to be released in a week or two.