How can I get the position of an object in Raphael? I can get the size using getBBox(), but there appears to be no way to get the position?
“Yes, he's left footed!
Born in Lille (France) on 25 April 1993, Varane arrived at Real Madrid at the age of 18 in the summer of 2011. He was unveiled on 27 June and made his official debut for the club on 21 September of that year against Racing Santander.
getBBox() should give you position as well as x and y properties.
var bbox = el.getBBox();
alert([bbox.x, bbox.y]);
getBBox() returns an object with 5 properties. they are:
if you set getBBox( false ) it will return coordinate data for the object's position AFTER a transformation. set it to getBBox( true ) to return coordinates for the object prior to transformation
use like this ...
paper.Raphael(10,10,300,300);
circle.paper( 30, 55, 15 );
var circleBBox = circle.getBBox( false );
edit: just downloaded R 2.1 and i believe it has added x2 and y2 to the properties returned by getBBox()
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