mirror of
https://github.com/nasa/openmct.git
synced 2025-06-23 01:18:57 +00:00
[Mobile] Gestures
MCTPinch adjusted the touch check to help differentiate between a two finger touch vs a single singer pan.
This commit is contained in:
@ -56,6 +56,7 @@ define(
|
|||||||
|
|
||||||
if (event.changedTouches.length === 2 ||
|
if (event.changedTouches.length === 2 ||
|
||||||
event.touches.length === 2) {
|
event.touches.length === 2) {
|
||||||
|
//console.log("PINCH START");
|
||||||
touchPosition = [trackPosition(event.touches[0]),
|
touchPosition = [trackPosition(event.touches[0]),
|
||||||
trackPosition(event.touches[1])];
|
trackPosition(event.touches[1])];
|
||||||
|
|
||||||
@ -70,6 +71,7 @@ define(
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
} else if (event.changedTouches.length === 1 ||
|
} else if (event.changedTouches.length === 1 ||
|
||||||
event.touches.length === 1) {
|
event.touches.length === 1) {
|
||||||
|
//console.log("*PAN START");
|
||||||
touchPosition = trackPosition(event.touches[0]);
|
touchPosition = trackPosition(event.touches[0]);
|
||||||
|
|
||||||
$scope.$emit('mct:pan:start', {
|
$scope.$emit('mct:pan:start', {
|
||||||
@ -81,15 +83,17 @@ define(
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// As the touch move occurs, the touches are tracked and
|
// As the touch move occurs, the touches are tracked and
|
||||||
// the event is emitted through scope
|
// the event is emitted through scope
|
||||||
function touchChange(event) {
|
function touchChange(event) {
|
||||||
var touchPosition;
|
var touchPosition;
|
||||||
|
|
||||||
if (event.changedTouches.length === 2) {
|
if (event.changedTouches.length === 2 ||
|
||||||
touchPosition = [trackPosition(event.changedTouches[0]),
|
event.touches.length === 2) {
|
||||||
trackPosition(event.changedTouches[1])];
|
//console.log("PINCH CHANGE");
|
||||||
|
touchPosition = [trackPosition(event.changedTouches[0] || event.touches[0]),
|
||||||
|
trackPosition(event.changedTouches[1] || event.touches[1])];
|
||||||
|
|
||||||
$scope.$emit('mct:pinch:change', {
|
$scope.$emit('mct:pinch:change', {
|
||||||
touches: touchPosition,
|
touches: touchPosition,
|
||||||
@ -100,7 +104,9 @@ define(
|
|||||||
|
|
||||||
// Stops other gestures/button clicks from being active
|
// Stops other gestures/button clicks from being active
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
} else if (event.changedTouches.length === 1) {
|
} else if (event.changedTouches.length === 1 ||
|
||||||
|
event.touches.length === 1) {
|
||||||
|
console.log("*PAN CHANGE");
|
||||||
touchPosition = trackPosition(event.changedTouches[0]);
|
touchPosition = trackPosition(event.changedTouches[0]);
|
||||||
|
|
||||||
$scope.$emit('mct:pan:change', {
|
$scope.$emit('mct:pan:change', {
|
||||||
|
Reference in New Issue
Block a user