Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Set button property to -1 if no mouse button is depressed
Browse files Browse the repository at this point in the history
Ref gh-242
Fixes gh-173
Closes gh-267
  • Loading branch information
Steditor authored and bethge committed Feb 18, 2016
1 parent 72c36f7 commit 24e6d2a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/mouse.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ var mouseEvents = {
if (!this.isEventSimulatedFromTouch(inEvent)) {
var e = this.prepareEvent(inEvent);
if (!HAS_BUTTONS) { this.prepareButtonsForMove(e, inEvent); }
e.button = -1;
dispatcher.move(e);
}
},
Expand All @@ -109,7 +110,8 @@ var mouseEvents = {
// FF Ubuntu includes the lifted button in the `buttons` property on
// mouseup.
// https://bugzilla.mozilla.org/show_bug.cgi?id=1223366
if (e.buttons === 0 || e.buttons === BUTTON_TO_BUTTONS[e.button]) {
e.buttons &= ~BUTTON_TO_BUTTONS[e.button];
if (e.buttons === 0) {
this.cleanupMouse();
dispatcher.up(e);
} else {
Expand All @@ -121,13 +123,15 @@ var mouseEvents = {
if (!this.isEventSimulatedFromTouch(inEvent)) {
var e = this.prepareEvent(inEvent);
if (!HAS_BUTTONS) { this.prepareButtonsForMove(e, inEvent); }
e.button = -1;
dispatcher.enterOver(e);
}
},
mouseout: function(inEvent) {
if (!this.isEventSimulatedFromTouch(inEvent)) {
var e = this.prepareEvent(inEvent);
if (!HAS_BUTTONS) { this.prepareButtonsForMove(e, inEvent); }
e.button = -1;
dispatcher.leaveOut(e);
}
},
Expand Down
3 changes: 1 addition & 2 deletions tests/intern.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ define({
],
functionalSuites: [

// See: https://github.com/jquery/PEP/issues/173
// 'tests/functional/pointerevent_button_attribute_mouse-manual',
'tests/functional/pointerevent_button_attribute_mouse-manual',
'tests/functional/pointerevent_capture_mouse-manual',
'tests/functional/pointerevent_capture_suppressing_mouse-manual',

Expand Down

0 comments on commit 24e6d2a

Please sign in to comment.