瀏覽代碼

Use Vector2._clone()

customisations
alemart 10 月之前
父節點
當前提交
d335b0052e
共有 1 個文件被更改,包括 3 次插入4 次删除
  1. 3
    4
      src/trackers/pointer-tracker/pointer-tracker.ts

+ 3
- 4
src/trackers/pointer-tracker/pointer-tracker.ts 查看文件

@@ -295,15 +295,14 @@ export class PointerTracker implements Tracker
295 295
 
296 296
             // determine the position delta
297 297
             const deltaPosition = !previous ? Vector2.Zero() :
298
-                                  new Vector2(position.x, position.y)._subtract(previous.position);
298
+                                  position._clone()._subtract(previous.position);
299 299
 
300 300
             // determine the initial position
301 301
             const initialPosition = previous ? previous.initialPosition :
302
-                                    Object.freeze(new Vector2(position.x, position.y));
302
+                                    Object.freeze(position._clone());
303 303
 
304 304
             // determine the velocity
305
-            const velocity = new Vector2(deltaPosition.x, deltaPosition.y)
306
-                             ._scale(inverseDeltaTime);
305
+            const velocity = deltaPosition._clone()._scale(inverseDeltaTime);
307 306
 
308 307
             // determine whether or not this is the primary pointer for this type
309 308
             const isPrimary = event.isPrimary;

Loading…
取消
儲存