mirror of
https://github.com/nasa/openmct.git
synced 2025-05-30 06:04:20 +00:00
[Mobile] Comments
Added comments to the MCTPinch file.
This commit is contained in:
parent
908fbdbf73
commit
7288db1908
@ -304,12 +304,12 @@ define(
|
|||||||
firstTouch = trackTouchPosition(touch, bounds).positionAsPlotPoint;
|
firstTouch = trackTouchPosition(touch, bounds).positionAsPlotPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Receives the emit of single touch pan start
|
// Receives the emit of single touch pan start
|
||||||
function onPanStart(event, touch) {
|
function onPanStart(event, touch) {
|
||||||
startPan(touch.touch, touch.bounds);
|
startPan(touch.touch, touch.bounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Receives the emit of single touch pan change
|
// Receives the emit of single touch pan change
|
||||||
function onPanChange(event, touch) {
|
function onPanChange(event, touch) {
|
||||||
updatePan(touch.touch, touch.bounds);
|
updatePan(touch.touch, touch.bounds);
|
||||||
}
|
}
|
||||||
@ -381,16 +381,17 @@ define(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Starts the zoom by emitting that viewport will be changed
|
// Starts the zoom by emitting that viewport will be changed
|
||||||
// also sets the first touch variable (midpoint) if panning will happen
|
// also sets the first touch variable (midpoint) if panning will
|
||||||
// and sets the distance between the first touches occurring
|
// happen and sets the distance between the first touches occurring
|
||||||
function startZoom(midpoint, bounds, touches, distance) {
|
function startZoom(midpoint, bounds, distance) {
|
||||||
$scope.$emit('user:viewport:change:start');
|
$scope.$emit('user:viewport:change:start');
|
||||||
firstTouchDistance = distance;
|
firstTouchDistance = distance;
|
||||||
firstTouch = trackTouchPosition(midpoint, bounds).positionAsPlotPoint;
|
firstTouch = trackTouchPosition(midpoint, bounds).positionAsPlotPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Receives the emit of the start of pinch touch
|
||||||
function onPinchStart(event, touch) {
|
function onPinchStart(event, touch) {
|
||||||
startZoom(touch.midpoint, touch.bounds, touch.touches, touch.distance);
|
startZoom(touch.midpoint, touch.bounds, touch.distance);
|
||||||
}
|
}
|
||||||
|
|
||||||
function comparePinchDrag(distance, prevDistance) {
|
function comparePinchDrag(distance, prevDistance) {
|
||||||
@ -398,17 +399,29 @@ define(
|
|||||||
((prevDistance - PINCH_DRAG_AMT) <= distance);
|
((prevDistance - PINCH_DRAG_AMT) <= distance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Receives the emit of the change of pinch touch,
|
||||||
|
// differentiates between a pan and zoom
|
||||||
function onPinchChange(event, touch) {
|
function onPinchChange(event, touch) {
|
||||||
|
|
||||||
|
// Will pan if change in distance is within PINCH_DRAG_AMT
|
||||||
|
// range relative to the previous distance
|
||||||
if(comparePinchDrag(Math.round(touch.distance),
|
if(comparePinchDrag(Math.round(touch.distance),
|
||||||
Math.round(prevTouchDistance || firstTouchDistance))) {
|
Math.round(prevTouchDistance || firstTouchDistance))) {
|
||||||
updatePan(touch.midpoint, touch.bounds);
|
updatePan(touch.midpoint, touch.bounds);
|
||||||
} else {
|
}
|
||||||
|
// Will pinch in any other situation that the distance between
|
||||||
|
// pinching touches is increasing or decreasing by more than
|
||||||
|
// PINCH_DRAG_AMT
|
||||||
|
else {
|
||||||
updateZoom(touch.midpoint, touch.bounds, touch.distance);
|
updateZoom(touch.midpoint, touch.bounds, touch.distance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sets previous touch distance to current touch.distance
|
||||||
prevTouchDistance = touch.distance;
|
prevTouchDistance = touch.distance;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
// Receives emit for touch event ending and emits that the
|
||||||
|
// viewport has stopped changing.
|
||||||
function onTouchEnd() {
|
function onTouchEnd() {
|
||||||
$scope.$emit('user:viewport:change:end', $scope.viewport);
|
$scope.$emit('user:viewport:change:end', $scope.viewport);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user