[Mobile, Gestures] Pan/Pinch

Added Destroy return function that
.off all touch events on elements.
And unbinds touch events from element.
This commit is contained in:
Shivam Dave 2015-08-07 14:26:23 -07:00
parent 7b371327e6
commit cac97401c6
2 changed files with 28 additions and 4 deletions

View File

@ -54,7 +54,7 @@ define(
$log.warn("PAN POS: " + touchPos);
// event.preventDefault();
event.preventDefault();
}
}
@ -64,7 +64,19 @@ define(
element.on('touchend', panAction);
}
return {
/**
* Detach any event handlers associated with this gesture.
* @method
* @memberof PanGesture
*/
destroy: function () {
element.off('touchstart', panAction);
element.off('touchmove', panAction);
element.off('touchend', panAction);
element.unbind('touchstart');
element.unbind('touchmove');
element.unbind('touchend');
}
};
}

View File

@ -60,7 +60,7 @@ define(
touchPosTwo = trackPosition(event.changedTouches[1]),
distance = calculateDistance(touchPosOne, touchPosTwo);
$log.warn("DIST: " + distance);
$log.warn("PINCH DIST: " + distance);
event.preventDefault();
}
@ -72,7 +72,19 @@ define(
element.on('touchend', pinchAction);
}
return {
/**
* Detach any event handlers associated with this gesture.
* @method
* @memberof PinchGesture
*/
destroy: function () {
element.off('touchstart', pinchAction);
element.off('touchmove', pinchAction);
element.off('touchend', pinchAction);
element.unbind('touchstart');
element.unbind('touchmove');
element.unbind('touchend');
}
};
}