javascript - draw2d on drag start event -


i want call custom callback function every time, when user starts dragging figures. tried so:

figure.ondragstart = function (x, y, shiftkey, ctrlkey) {     myfunc(); }; 

but problem is, every time when function called, figure positioned 0,0 coordinate. i'm not sure wrong , how can fix it.

instead of redefining ondragstart method, can handle dragstart event:

figure.on("dragstart", function(event, ui) {     // }); 

according the draw2d documentation, event triggered ondragstart. ui parameter contains x, y, shiftkey , ctrlkey.

you can see code in action in this jsfiddle. message displayed in console when start dragging rectangle. green rectangle uses dragstart event , responds correctly. red 1 redefines ondragstart method, problem mentioned in question.


Comments

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

go - golang pprof for c library code -