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

Commit

Permalink
use case-insenstive event checking
Browse files Browse the repository at this point in the history
  • Loading branch information
dfreedm committed Aug 5, 2014
1 parent 9c0b190 commit 40e9440
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/dispatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
obj.listeners = 0;
obj.index = this.gestures.length;
for (var i = 0, g; i < source.exposes.length; i++) {
g = source.exposes[i];
g = source.exposes[i].toLowerCase();
this.dependencyMap[g] = obj;
}
this.gestures.push(source);
Expand Down Expand Up @@ -319,7 +319,8 @@
* @return Boolean `gesture` is a valid gesture
*/
scope.activateGesture = function(node, gesture) {
var dep = dispatcher.dependencyMap[gesture];
var g = gesture.toLowerCase();
var dep = dispatcher.dependencyMap[g];
if (dep) {
var recognizer = dispatcher.gestures[dep.index];
if (dep.listeners === 0) {
Expand All @@ -334,7 +335,7 @@
}
// TODO(dfreedm): re-evaluate bookkeeping to avoid using attributes
if (recognizer) {
var touchAction = recognizer.defaultActions && recognizer.defaultActions[gesture];
var touchAction = recognizer.defaultActions && recognizer.defaultActions[g];
var actionNode;
switch(node.nodeType) {
case Node.ELEMENT_NODE:
Expand Down Expand Up @@ -382,7 +383,8 @@
* @return Boolean `gesture` is a valid gesture
*/
scope.deactivateGesture = function(node, gesture) {
var dep = dispatcher.dependencyMap[gesture];
var g = gesture.toLowerCase();
var dep = dispatcher.dependencyMap[g];
if (dep) {
if (dep.listeners > 0) {
dep.listeners--;
Expand Down

0 comments on commit 40e9440

Please sign in to comment.