Explorar el Código

Merge pull request #7731 from CedricGuillemet/fixDragEndEventAtDispose

check dragging state before notifying drag end
David Catuhe hace 5 años
padre
commit
730fdd0951
Se han modificado 1 ficheros con 5 adiciones y 2 borrados
  1. 5 2
      src/Behaviors/Meshes/pointerDragBehavior.ts

+ 5 - 2
src/Behaviors/Meshes/pointerDragBehavior.ts

@@ -245,8 +245,11 @@ export class PointerDragBehavior implements Behavior<AbstractMesh> {
      * Force relase the drag action by code.
      */
     public releaseDrag() {
-        this.dragging = false;
-        this.onDragEndObservable.notifyObservers({ dragPlanePoint: this.lastDragPosition, pointerId: this.currentDraggingPointerID });
+        if (this.dragging) {
+            this.onDragEndObservable.notifyObservers({ dragPlanePoint: this.lastDragPosition, pointerId: this.currentDraggingPointerID });
+            this.dragging = false;
+        }
+
         this.currentDraggingPointerID = -1;
         this._moving = false;