Prevent the user from flipping the camera upside down in the 3D view

This commit is contained in:
Patrick Walton 2017-09-15 09:31:19 -07:00
parent 82f876c4ff
commit 445d00fed3
1 changed files with 3 additions and 1 deletions

View File

@ -277,7 +277,9 @@ export class PerspectiveCamera extends Camera {
return;
this.rotation[0] += event.movementX * PERSPECTIVE_ROTATION_SPEED;
this.rotation[1] += event.movementY * PERSPECTIVE_ROTATION_SPEED;
const trialYRotation = this.rotation[1] + event.movementY * PERSPECTIVE_ROTATION_SPEED;
this.rotation[1] = _.clamp(trialYRotation, -Math.PI * 0.5, Math.PI * 0.5);
if (this.onChange != null)
this.onChange();