philogb/jit — pull request #142 by russellsmith (2013-03-20 02:40:19+00:00)
Title: MouseMove event prevents onClick handler from firing

This problem occurs when events are handled in the following order:

1) User clicks down on their mouse which fires the mouseDown event. This results in a Boolean called ‘pressed’ to bet set to true.

2) Browser fires off a mouseMove event which checks if pressed is true, and if so sets a Boolean ‘moved’ to true to indicate the user is click+dragging.

3) User releases mouse which fires mouseUp event. Normally this would then fire the onClick handler, if one exists, but if moved is set to true this doesn’t get called.

MouseMove will fire at times even when the mouse is not moving which prevents onClick handlers from firing reliably. This check to see that at least one pixel of movement occurred has alleviated this for me.