mirror of
https://github.com/nasa/openmct.git
synced 2025-06-01 15:10:50 +00:00
[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:
parent
7b371327e6
commit
cac97401c6
@ -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');
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -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');
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user