Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
Make sure down and up gestures register a node for touch events
Browse files Browse the repository at this point in the history
  • Loading branch information
dfreedm committed Jul 31, 2014
1 parent 1710d19 commit 8e29bfb
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/dispatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,11 @@
eventSourceList: [],
gestures: [],
// map gesture event -> {listeners: int, index: gestures[int]}
dependencyMap: Object.create(null),
dependencyMap: {
// make sure down and up are in the map to trigger "register"
down: {listeners: 0, index: -1},
up: {listeners: 0, index: -1}
},
gestureQueue: [],
/**
* Add a new event source that will generate pointer events.
Expand Down Expand Up @@ -318,7 +322,10 @@
var dep = dispatcher.dependencyMap[gesture];
if (dep) {
if (dep.listeners === 0) {
dispatcher.gestures[dep.index].enabled = true;
var recognizer = dispatcher.gestures[dep.index];
if (recognizer) {
recognizer.enabled = true;
}
}
dep.listeners++;
if (!node._pgListeners) {
Expand Down Expand Up @@ -361,7 +368,10 @@
dep.listeners--;
}
if (dep.listeners === 0) {
dispatcher.gestures[dep.index].enabled = false;
var recognizer = dispatcher.gestures[dep.index];
if (recognizer) {
recognizer.enabled = false;
}
}
if (node._pgListeners > 0) {
node._pgListeners--;
Expand Down

0 comments on commit 8e29bfb

Please sign in to comment.