Explorar o código

Merge pull request #2838 from aWeirdo/patch-14

Update babylon.scene.ts
David Catuhe %!s(int64=8) %!d(string=hai) anos
pai
achega
c07f949a22
Modificáronse 1 ficheiros con 5 adicións e 2 borrados
  1. 5 2
      src/babylon.scene.ts

+ 5 - 2
src/babylon.scene.ts

@@ -1484,6 +1484,9 @@
             };
 
             this._onPointerUp = (evt: PointerEvent) => {
+		if (!this._isButtonPressed) {
+			return;
+		}
                 this._isButtonPressed = false;
                 this._pickedUpMesh = null;
                 this._meshPickProceed = false;
@@ -1630,7 +1633,7 @@
             }
 
             if (attachUp) {
-                canvas.addEventListener(eventPrefix + "up", this._onPointerUp, false);
+                window.addEventListener(eventPrefix + "up", this._onPointerUp, false);
             }
 
             canvas.tabIndex = 1;
@@ -1643,7 +1646,7 @@
 
             canvas.removeEventListener(eventPrefix + "move", this._onPointerMove);
             canvas.removeEventListener(eventPrefix + "down", this._onPointerDown);
-            canvas.removeEventListener(eventPrefix + "up", this._onPointerUp);
+            window.removeEventListener(eventPrefix + "up", this._onPointerUp);
 
             engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver);
             engine.onCanvasFocusObservable.remove(this._onCanvasFocusObserver);