Pārlūkot izejas kodu

fixed issue with pointerlock not unlocking with freecamera

Adam Bowman 9 gadi atpakaļ
vecāks
revīzija
cf4d12b7f9

+ 7 - 0
src/Cameras/Inputs/babylon.freecamera.input.mouse.ts

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