How to get getBBox in a jQuerySVG project?

2.6k Views Asked by At

I have a variable defined as :

var myVariable = svg.path(g,"A path here");

where g is a group (var g = svg.group();)

How to get its bounding box via jQuerySVG ?

I tried myVariable.getBBox(), $(myVariable).getBBox(), but this doesn't work...

Thanks.

2

There are 2 best solutions below

0
On

try

$(myVariable)[0].getBBox()
0
On

Try using the bounding box of the group that contains the path:

var box = g.getBoundingClientRect();