What's the best way to get the bounding box of several Raphael objects as a whole?
Can I put them all in a set
and call mySet.getBBox()
?
Or do I need to loop through them all, get bbox
for each one and calculate the overall height and width?
(Also, I can't use SVG directly - I need VML support.)
Uh. It's really easy. (Thanks @Dylan):
var paper = Raphael ('test', 100, 100);
var circles = paper.set();
var c1 = paper.circle(70,30,10);
var c2 = paper.circle(50,10,10);
var c3 = paper.circle(10,80,10);
circles.push(c1, c2, c3);
alert(c3.getBBox().width); // --> 20
alert(circles.getBBox().width); // --> 80
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With