add panBack() to orbit controls
This commit is contained in:
parent
e525d12552
commit
ad271263e1
2 changed files with 13 additions and 6 deletions
|
|
@ -162,6 +162,16 @@ MOTO.Orbit = function (object, domElement, notify, slider) {
|
|||
pan.add(panOffset);
|
||||
};
|
||||
|
||||
// pass in distance in world space to move backward
|
||||
this.panBack = function (distance) {
|
||||
let te = this.object.matrix.elements;
|
||||
|
||||
// get Y column of matrix
|
||||
panOffset.set(te[ 8 ], te[ 9 ], te[ 10 ]);
|
||||
panOffset.multiplyScalar(distance);
|
||||
pan.add(panOffset);
|
||||
};
|
||||
|
||||
// pass in x,y of change desired in pixel space,
|
||||
// right and down are positive
|
||||
this.pan = function (deltaX, deltaY) {
|
||||
|
|
@ -447,18 +457,12 @@ MOTO.Orbit = function (object, domElement, notify, slider) {
|
|||
delta = -delta;
|
||||
}
|
||||
|
||||
let saveZoomSpeed = scope.zoomSpeed;
|
||||
if (event.ctrlKey) scope.zoomSpeed *= 2;
|
||||
if (event.metaKey) scope.zoomSpeed *= 2;
|
||||
|
||||
if (delta > 0) {
|
||||
scope.dollyOut();
|
||||
} else if (delta < 0) {
|
||||
scope.dollyIn();
|
||||
}
|
||||
|
||||
scope.zoomSpeed = saveZoomSpeed;
|
||||
|
||||
scope.update();
|
||||
scope.dispatchEvent(startEvent);
|
||||
scope.dispatchEvent(endEvent);
|
||||
|
|
|
|||
|
|
@ -1061,6 +1061,9 @@
|
|||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
get ctrl() {
|
||||
return viewControl;
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue