Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Raphael Position

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?

like image 349
Marc Avatar asked Oct 25 '10 21:10

Marc


People also ask

What is Varanes dominant foot?

“Yes, he's left footed!

How long has Varane played for Madrid?

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.


2 Answers

getBBox() should give you position as well as x and y properties.

var bbox = el.getBBox();
alert([bbox.x, bbox.y]);
like image 63
Dmitry Baranovskiy Avatar answered Oct 07 '22 00:10

Dmitry Baranovskiy


getBBox() returns an object with 5 properties. they are:

  1. x
  2. y
  3. width
  4. height
  5. toString()

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()

like image 43
b_dubb Avatar answered Oct 07 '22 00:10

b_dubb