Skip to content
Advertisement

Dragging multiple layers in JavaScript with KineticJS

I’m trying to synchronize dragging of multiple layers. Example here: http://jsfiddle.net/e8Z3a/

JavaScript

The problem is the sync is missing some events. After doing a series of short drags, the mustache layer stays behind, as if it was missing some events on the way.

My observation leads to a guess, that fast dragging works. I mean if you grab the image without moving the mouse, move quickly in random directions, stop the mouse and then let go, layers stay in sync. The problem is with grabbing and letting go while the mouse moves.

Can you teach me how to debug this kind of problems? Is there a TDD-like approach for events related stuff? Any way to maybe record a series of events and than replay it, while adding some debug code? Classic step-by-step debugging is quite useless here…

Advertisement

Answer

I would go simple,

JavaScript

My example, http://jsfiddle.net/QTu8K/38 (updated)

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement