I am trying to implement a menu in Javascript with single menu-items being svg:g.
To mark an item as selected I would like to move another svg:g on top of the menu-item.
For this I need to get the bounding box of the menu-item (=svg:g) so I can apply the rect (x, y, width, height) to the other. I have not found a convenient way yet, for getting the bounding box of a svg:g.
The only way I can think of would be recursing into the children and calculating the bounding box (approximation) by hand. Is there a more elegant way?
You should just be able to use the
getBBoxmethod of your group element.e.g. http://jsfiddle.net/PFnre/1/