Skip to content Skip to sidebar Skip to footer

Delegating Drag Function In Raphael

Using Raphael, I wish to be able to drag a shape (an ellipse in the example below) containing a text object, dragging either the shape or the text. I hoped to do this by setting th

Solution 1:

// Associate the shape and text elements with each other
shape.text = text;
text.shape = shape;

You are adding attributes to Raphael objects. Without knowing how Raphael works (or will work in the future) this is dangerous and apparently also what's causing the problem. If you really want to associate them i recommend using Raphaels Element.data: http://raphaeljs.com/reference.html#Element.data


Post a Comment for "Delegating Drag Function In Raphael"