mirror of
https://github.com/nasa/openmct.git
synced 2025-06-15 05:38:12 +00:00
Pinch to zoom and wheel zoom work the same way (#3752)
This commit is contained in:
@ -413,6 +413,21 @@ define([
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isPinchToZoom = event.ctrlKey === true;
|
||||||
|
let isZoomIn = event.wheelDelta < 0;
|
||||||
|
let isZoomOut = event.wheelDelta >= 0;
|
||||||
|
|
||||||
|
//Flip the zoom direction if this is pinch to zoom
|
||||||
|
if (isPinchToZoom) {
|
||||||
|
if (isZoomIn === true) {
|
||||||
|
isZoomOut = true;
|
||||||
|
isZoomIn = false;
|
||||||
|
} else if (isZoomOut === true) {
|
||||||
|
isZoomIn = true;
|
||||||
|
isZoomOut = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let xDisplayRange = this.$scope.xAxis.get('displayRange');
|
let xDisplayRange = this.$scope.xAxis.get('displayRange');
|
||||||
let yDisplayRange = this.$scope.yAxis.get('displayRange');
|
let yDisplayRange = this.$scope.yAxis.get('displayRange');
|
||||||
|
|
||||||
@ -445,7 +460,7 @@ define([
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.wheelDelta < 0) {
|
if (isZoomIn) {
|
||||||
|
|
||||||
this.$scope.xAxis.set('displayRange', {
|
this.$scope.xAxis.set('displayRange', {
|
||||||
min: xDisplayRange.min + ((xAxisDist * ZOOM_AMT) * xAxisMinDist),
|
min: xDisplayRange.min + ((xAxisDist * ZOOM_AMT) * xAxisMinDist),
|
||||||
@ -456,7 +471,7 @@ define([
|
|||||||
min: yDisplayRange.min + ((yAxisDist * ZOOM_AMT) * yAxisMinDist),
|
min: yDisplayRange.min + ((yAxisDist * ZOOM_AMT) * yAxisMinDist),
|
||||||
max: yDisplayRange.max - ((yAxisDist * ZOOM_AMT) * yAxisMaxDist)
|
max: yDisplayRange.max - ((yAxisDist * ZOOM_AMT) * yAxisMaxDist)
|
||||||
});
|
});
|
||||||
} else if (event.wheelDelta >= 0) {
|
} else if (isZoomOut) {
|
||||||
|
|
||||||
this.$scope.xAxis.set('displayRange', {
|
this.$scope.xAxis.set('displayRange', {
|
||||||
min: xDisplayRange.min - ((xAxisDist * ZOOM_AMT) * xAxisMinDist),
|
min: xDisplayRange.min - ((xAxisDist * ZOOM_AMT) * xAxisMinDist),
|
||||||
|
Reference in New Issue
Block a user