Selaa lähdekoodia

Merge pull request #8856 from sebavan/master

Fix #8850
sebavan 5 vuotta sitten
vanhempi
commit
56d8c12a78
1 muutettua tiedostoa jossa 9 lisäystä ja 5 poistoa
  1. 9 5
      src/Behaviors/Meshes/pointerDragBehavior.ts

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

@@ -203,12 +203,16 @@ export class PointerDragBehavior implements Behavior<AbstractMesh> {
                 var pointerId = (<PointerEvent>pointerInfo.event).pointerId;
 
                 // If drag was started with anyMouseID specified, set pointerID to the next mouse that moved
-                if (this.currentDraggingPointerID === PointerDragBehavior._AnyMouseID && pointerId !== PointerDragBehavior._AnyMouseID && (<PointerEvent>pointerInfo.event).pointerType == "mouse") {
-                    if (this._lastPointerRay[this.currentDraggingPointerID]) {
-                        this._lastPointerRay[pointerId] = this._lastPointerRay[this.currentDraggingPointerID];
-                        delete this._lastPointerRay[this.currentDraggingPointerID];
+                if (this.currentDraggingPointerID === PointerDragBehavior._AnyMouseID && pointerId !== PointerDragBehavior._AnyMouseID) {
+                    const evt = <PointerEvent>pointerInfo.event;
+                    const isMouseEvent = evt.pointerType === "mouse" || (!this._scene.getEngine().hostInformation.isMobile && evt instanceof MouseEvent);
+                    if (isMouseEvent) {
+                        if (this._lastPointerRay[this.currentDraggingPointerID]) {
+                            this._lastPointerRay[pointerId] = this._lastPointerRay[this.currentDraggingPointerID];
+                            delete this._lastPointerRay[this.currentDraggingPointerID];
+                        }
+                        this.currentDraggingPointerID = pointerId;
                     }
-                    this.currentDraggingPointerID = pointerId;
                 }
 
                 // Keep track of last pointer ray, this is used simulating the start of a drag in startDrag()