views:

242

answers:

0

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)! What does "a point based object" even means?

I found no refence for the 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 rectangel myself, you know, the only really problematic shapes I need bounding box for are the Group and the Text.

I ended hotpatching dojo like so:

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?