Bläddra i källkod

a better fix for freecamera pointer unlock issue

Adam Bowman 9 år sedan
förälder
incheckning
1991ce4774
1 ändrade filer med 2 tillägg och 12 borttagningar
  1. 2 12
      src/Cameras/Inputs/babylon.freecamera.input.mouse.ts

+ 2 - 12
src/Cameras/Inputs/babylon.freecamera.input.mouse.ts

@@ -10,8 +10,7 @@ module BABYLON {
         private _observer: Observer<PointerInfo>;
         private _observer: Observer<PointerInfo>;
 
 
         private previousPosition: { x: number, y: number };
         private previousPosition: { x: number, y: number };
-        private _isPointerLock = false;
-
+        
         constructor(public touchEnabled = true) {
         constructor(public touchEnabled = true) {
         }
         }
 
 
@@ -26,12 +25,6 @@ module BABYLON {
                         return;
                         return;
                     }
                     }
 
 
-                    if (this._isPointerLock && !engine.isPointerLock) {
-						this.previousPosition = null;
-					}
-					
-					this._isPointerLock = engine.isPointerLock;
-
                     if (p.type === PointerEventTypes.POINTERDOWN) {
                     if (p.type === PointerEventTypes.POINTERDOWN) {
                         try {
                         try {
                             evt.srcElement.setPointerCapture(evt.pointerId);
                             evt.srcElement.setPointerCapture(evt.pointerId);
@@ -106,10 +99,7 @@ module BABYLON {
                 
                 
                 camera.cameraRotation.x += offsetY / this.angularSensibility;
                 camera.cameraRotation.x += offsetY / this.angularSensibility;
 
 
-                this.previousPosition = {
-                    x: evt.clientX,
-                    y: evt.clientY
-                };
+                this.previousPosition = null;
                 
                 
                 if (!noPreventDefault) {
                 if (!noPreventDefault) {
                     evt.preventDefault();
                     evt.preventDefault();