Browse Source

Use Vector2._clone()

customisations
alemart 10 months ago
parent
commit
d335b0052e
1 changed files with 3 additions and 4 deletions
  1. 3
    4
      src/trackers/pointer-tracker/pointer-tracker.ts

+ 3
- 4
src/trackers/pointer-tracker/pointer-tracker.ts View File

295
 
295
 
296
             // determine the position delta
296
             // determine the position delta
297
             const deltaPosition = !previous ? Vector2.Zero() :
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
             // determine the initial position
300
             // determine the initial position
301
             const initialPosition = previous ? previous.initialPosition :
301
             const initialPosition = previous ? previous.initialPosition :
302
-                                    Object.freeze(new Vector2(position.x, position.y));
302
+                                    Object.freeze(position._clone());
303
 
303
 
304
             // determine the velocity
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
             // determine whether or not this is the primary pointer for this type
307
             // determine whether or not this is the primary pointer for this type
309
             const isPrimary = event.isPrimary;
308
             const isPrimary = event.isPrimary;

Loading…
Cancel
Save