فهرست منبع

new attempt to fix the pointer events :)

David Catuhe 6 سال پیش
والد
کامیت
91c00c0d96
1فایلهای تغییر یافته به همراه17 افزوده شده و 6 حذف شده
  1. 17 6
      src/babylon.scene.ts

+ 17 - 6
src/babylon.scene.ts

@@ -1802,7 +1802,7 @@ module BABYLON {
                 this._pickedDownMesh.actionManager.processTrigger(ActionManager.OnPickOutTrigger, ActionEvent.CreateNew(this._pickedDownMesh, evt));
             }
 
-            let type = PointerEventTypes.POINTERUP;
+            let type = 0;
             if (this.onPointerObservable.hasObservers()) {
                 if (!clickInfo.ignore && !clickInfo.hasSwiped) {
                     if (clickInfo.singleClick && this.onPointerObservable.hasSpecificMask(PointerEventTypes.POINTERTAP)) {
@@ -1811,10 +1811,20 @@ module BABYLON {
                     else if (clickInfo.doubleClick && this.onPointerObservable.hasSpecificMask(PointerEventTypes.POINTERDOUBLETAP)) {
                         type = PointerEventTypes.POINTERDOUBLETAP;
                     }
+                    if (type) {
+                        let pi = new PointerInfo(type, evt, pickResult);
+                        this._setRayOnPointerInfo(pi);
+                        this.onPointerObservable.notifyObservers(pi, type);
+                    }
+                }
+
+                if (!clickInfo.ignore) {
+                    type = PointerEventTypes.POINTERUP;
+
+                    let pi = new PointerInfo(type, evt, pickResult);
+                    this._setRayOnPointerInfo(pi);
+                    this.onPointerObservable.notifyObservers(pi, type);
                 }
-                let pi = new PointerInfo(type, evt, pickResult);
-                this._setRayOnPointerInfo(pi);
-                this.onPointerObservable.notifyObservers(pi, type);
             }
 
             if (this.onPointerUp && !clickInfo.ignore) {
@@ -1981,8 +1991,9 @@ module BABYLON {
                     }
                 }
 
-                clickInfo.ignore = needToIgnoreNext;
-                cb(clickInfo, this._currentPickResult);
+                if (!needToIgnoreNext) {
+                    cb(clickInfo, this._currentPickResult);
+                }
             };
 
             this._onPointerMove = (evt: PointerEvent) => {