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?