Skip to content

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

Open
@martinAnsty

Description

@martinAnsty

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions