Skip to content

Commit

Permalink
Use & instead of | (#4)
Browse files Browse the repository at this point in the history
The intention of this snippet is to return true when the primary mouse
button is released. For that, a bitmask should be applied to only check
the primary button. I mistakenly used bitwise OR instead or AND, and as
a result the event.buttons check always returned false (`!1 == false`).
  • Loading branch information
Rob--W committed May 7, 2016
1 parent 07bb72a commit b81897b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion grab-to-pan.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ var GrabToPan = (function GrabToPanClosure() {
// http://www.w3.org/TR/DOM-Level-3-Events/#events-MouseEvent-buttons
// Firefox 15+
// Internet Explorer 10+
return !(event.buttons | 1);
return !(event.buttons & 1);
}
if (isChrome15OrOpera15plus || isSafari6plus) {
// Chrome 14+
Expand Down

0 comments on commit b81897b

Please sign in to comment.