Skip to content

Commit

Permalink
Merge pull request #665 from jbrantly/issue-664-pointer-events-bug
Browse files Browse the repository at this point in the history
Fixing pointer events bug falsely detecting multiple pointers
  • Loading branch information
jtangelder committed Sep 16, 2014
2 parents 10a2909 + 9640e68 commit 163ead7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/input/pointerevent.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,20 @@ inherit(PointerEventInput, Input, {

var isTouch = (pointerType == INPUT_TYPE_TOUCH);

// get index of the event in the store
var storeIndex = inArray(store, ev.pointerId, 'pointerId');

// start and mouse must be down
if (eventType & INPUT_START && (ev.button === 0 || isTouch)) {
store.push(ev);
if (storeIndex < 0) {
store.push(ev);
storeIndex = store.length - 1;
}
} else if (eventType & (INPUT_END | INPUT_CANCEL)) {
removePointer = true;
}

// get index of the event in the store
// it not found, so the pointer hasn't been down (so it's probably a hover)
var storeIndex = inArray(store, ev.pointerId, 'pointerId');
if (storeIndex < 0) {
return;
}
Expand Down

0 comments on commit 163ead7

Please sign in to comment.