Kaynağa Gözat

check dragging state before notifying drag end

Cedric Guillemet 5 yıl önce
ebeveyn
işleme
dd341db335
1 değiştirilmiş dosya ile 5 ekleme ve 2 silme
  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;