Reputation: 753
Learning raphael.js, it seems all objects default to having their x and y coordinates be a reference to the center of the object. This is fine in most cases but I would like the ability to also position an object using one of its corners. Is there a way this parameter can be changed for a given object?
Upvotes: 0
Views: 170
Reputation: 1436
No x and y attributes normally point to the top left of an Element this is certainly the case with rectangle and image. A circle and ellipse do not have x and y attributes but cx and cy which are there centers. If you use a text by default x is at the very middle of the text as is y. If you made a circle and and gave the text the cx and cy values of the circle for it's x y attributes it would be painted in the centre of the circle Look at Element.getBBox() also this will give you attributes of the space the Element occupies Good luck..
Upvotes: 1