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

click event fired for both left and right mouse button #926

Open
martinAnsty opened this issue Nov 20, 2017 · 1 comment
Open

click event fired for both left and right mouse button #926

martinAnsty opened this issue Nov 20, 2017 · 1 comment

Comments

@martinAnsty
Copy link

At the very least this is a mismatch between actual behaviour and documented behaviour. The docs say click events are dispatched when the left mouse button is pressed and released on a display object:

/**
* Dispatched when the user presses their left mouse button and then releases it while over the display object.
* See the {{#crossLink "MouseEvent"}}{{/crossLink}} class for a listing of event properties.
* @event click
* @since 0.6.0
*/

This matches the behaviour of native dom events, where click is fired for the primary mouse button but not the secondary button (unlike mousedown/up which fire for any mouse button).

However EaselJS doesn't listen to native click events on the canvas element, instead it dispatches its click events from the mouseup listener. The only check is that the mouseup occured over the same display object as the originating mousedown:

if (target == oTarget) { this._dispatchMouseEvent(oTarget, "click", true, id, o, e); }

Should EaselJS be checking the mouse button before dispatching the click event? (That's what PixiJS does)

Or are the docs wrong, and click events are supposed to be dispatched for the secondary mouse button?

@shindeshubham582
Copy link

Click should work on a primary key but it is also working for other keys also.
I have came across one scenario where pressUp of left click is getting missed and that is creating an issue.
steps are as follows:
1.left mouseDown on object.
2.right mouseDown on same object.
3.right pressUp on object.

if we follow this order left mouseUp is getting missed it is not getting fired nor it is present after that point.

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

No branches or pull requests

3 participants