瀏覽代碼

Fix writing to the pointerId readonly property when it exists (#8674)

Popov72 5 年之前
父節點
當前提交
29da5cc654
共有 1 個文件被更改,包括 9 次插入3 次删除
  1. 9 3
      src/Inputs/scene.inputManager.ts

+ 9 - 3
src/Inputs/scene.inputManager.ts

@@ -608,7 +608,9 @@ export class InputManager {
 
         this._onPointerMove = (evt: PointerEvent) => {
             // preserve compatibility with Safari when pointerId is not present
-            (evt as any).pointerId = evt.pointerId ?? 0;
+            if ((evt as any).pointerId === undefined) {
+                (evt as any).pointerId = 0;
+            }
 
             this._updatePointerPosition(evt);
 
@@ -637,7 +639,9 @@ export class InputManager {
             this._meshPickProceed = false;
 
             // preserve compatibility with Safari when pointerId is not present
-            (evt as any).pointerId = evt.pointerId ?? 0;
+            if ((evt as any).pointerId === undefined) {
+                (evt as any).pointerId = 0;
+            }
 
             this._updatePointerPosition(evt);
 
@@ -684,7 +688,9 @@ export class InputManager {
             this._meshPickProceed = false;
 
             // preserve compatibility with Safari when pointerId is not present
-            (evt as any).pointerId = evt.pointerId ?? 0;
+            if ((evt as any).pointerId === undefined) {
+                (evt as any).pointerId = 0;
+            }
 
             this._updatePointerPosition(evt);