waterbearlang/waterbear — pull request #660 by dethe (2014-02-26 08:13:02+00:00)
Title: fix for 638

There was a problem with the startDrag handler being called after the endDrag. Since `dragging` is set to true in startDrag, and endDrag returns immediately if not `dragging`, the endDrag was not cancelling the drag on a click without moving the pointer.

Always cancelling the startDrag by setting dragTarget to null in endDrag didn't work, because we need that in the case of a real drag. Unfortunately, the solution seems to be the introduction of yet another variable: `pointerDown` which is set to true in initDrag and false in endDrag, and if false when startDrag is called, it returns immediately. Now dragging seems to work fine and not-dragging does not create weird dragging states.