Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MouseMove event prevents onClick handler from firing #142

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

MouseMove event prevents onClick handler from firing #142

wants to merge 4 commits into from

Conversation

russellsmith
Copy link

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.

unknown and others added 3 commits March 18, 2013 17:06
listeners which prevents Ember.js observables from firing.
boolean is used to indicate the user is click + dragging in the interface
and if set will prevent onClick handlers for nodes from firing.  onClick
events are prevented from firing on line 265 of Extras.js.
@russellsmith
Copy link
Author

Whoops, had intended for only the last commit to be in the request. Guess that's not possible?

@@ -167,7 +167,7 @@ $jit.Graph = new Class({
this.nodes[obj.id] = new Graph.Node($.extend({
'id': obj.id,
'name': obj.name,
'data': $.merge(obj.data || {}, {}),
'data': obj.data || {},
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you removing the merge operation? The idea is to clone the object.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my application I'm adding Ember.js objects to my the data hash. Ember objects have observer functions tied to data properties that will get fired when a property is modified. The merge operation copies the data but in doing so unsets the observers.

In my case I don't want to have a clone of the object in this hash, I want the object itself so that the object state remains consistent within the application. I hadn't intended for this change to be a part of the pull request, but why does the object need to be cloned in the first place?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants