In Raphel.js, how to get the width and height of a BBox group of Raphael objects?
For example, I drew some elements on my Rapheal paper, as shown below:
var paper = Raphael(10, 50, 320, 200);
var st = paper.set();
var c = paper.rect(40, 40, 50, 50, 10);
var e = paper.ellipse(50, 50, 40, 20);
var i = paper.image("apple.png", 10, 10, 80, 80);
var t = paper.text(50, 50, "Raphaël\nkicks\nbutt!");
...
st.push(c, e, i, t ...);
I tried using the following method to get the width and height of a BBox group of elements:
var myBBox = st.getBBox();
var width = myBBox.width;
var height = myBBox.height;
console.log(width+','+height);
Sometimes it works, but sometimes I got the Infinity value for height. I think this is Raphael's mistake. So, if I want to get the current BBox size of my canvas (group of elements), what is the right way to do this?