I have the following RaphaelJS based path
var myPath = ctx.path("M 15 15 l 240 0 l 60 215 l -300 -70 z");
In the following 'canvas'
var ctx = new Raphael(document.getElementById('myCanvasId'));
ctx.setViewBox(0,0,w,h,true);
ctx.setSize('100%', '100%');
Problem is, i cant get new attached elements to the canvas to fire the onDragOver event i put on myPath, which is simply:
myPath.onDragOver(function(e) { alert('fired'); });
And the element creation is done dynamically, so are the bind on the elements. They're stored within a variable, that can be accessed anywhere after it's defined.
The element is created by:
ctx.rect((positionBox.x2 - positionBox.x) / 2 + randomX, (positionBox.y2 - positionBox.y) / 2 + randomY, postitSize.x, postitSize.y)
And the drag is binded by
postIts[postItCount]['item'].drag(move, start, up);
And the drag handling event functions are
var start = function () {
this.odx = 0;
this.ody = 0;
this.animate({"fill-opacity": 0.8}, 200);
},move = function (dx, dy) {
this.translate(dx - this.odx, dy - this.ody);
this.odx = dx;
this.ody = dy;
},
up = function () {
this.animate({"fill-opacity": 1}, 200);
console.log('end', this.odx, this.ody);
};
Still when i drag the created element over the one i binded with onDragOver, nothing is fired, in any way.
Is there anything i'm missing?
Thanks in advance.