浏览代码

Rename TrackablePointer.totalDistance to TrackablePointer.movementLength

customisations
alemart 9 个月前
父节点
当前提交
ec2a3e01f5

+ 3
- 3
docs/api/trackable-pointer.md 查看文件

58
 
58
 
59
 The elapsed time, in seconds, since the tracking of this pointer began.
59
 The elapsed time, in seconds, since the tracking of this pointer began.
60
 
60
 
61
-### totalDistance
61
+### movementLength
62
 
62
 
63
-`pointer.totalDistance: number, read-only`
63
+`pointer.movementLength: number, read-only`
64
 
64
 
65
-How much this pointer has moved, in space units, since its tracking began. You can get the average speed of motion by calculating the ratio `totalDistance / duration`.
65
+How much this pointer has moved, in space units, since its tracking began. You can get the average speed of motion by calculating the ratio `movementLength / duration`.
66
 
66
 
67
 ### isPrimary
67
 ### isPrimary
68
 
68
 

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

381
             const duration = previous ? previous.duration + deltaTime : 0;
381
             const duration = previous ? previous.duration + deltaTime : 0;
382
 
382
 
383
             // determine how much this pointer has moved since its tracking began
383
             // determine how much this pointer has moved since its tracking began
384
-            const totalDistance = previous ? previous.totalDistance + deltaPosition.length() : 0;
384
+            const movementLength = previous ? previous.movementLength + deltaPosition.length() : 0;
385
 
385
 
386
             // determine whether or not this is the primary pointer for this type
386
             // determine whether or not this is the primary pointer for this type
387
             const isPrimary = event.isPrimary;
387
             const isPrimary = event.isPrimary;
391
 
391
 
392
             // we create new trackable instances on each frame;
392
             // we create new trackable instances on each frame;
393
             // these will be exported and consumed by the user
393
             // these will be exported and consumed by the user
394
-            this._newPointers.set(id, { id, phase, position, deltaPosition, initialPosition, velocity, duration, totalDistance, isPrimary, kind });
394
+            this._newPointers.set(id, { id, phase, position, deltaPosition, initialPosition, velocity, duration, movementLength, isPrimary, kind });
395
 
395
 
396
         }
396
         }
397
 
397
 

+ 1
- 1
src/trackers/pointer-tracker/trackable-pointer.ts 查看文件

60
     readonly duration: number;
60
     readonly duration: number;
61
 
61
 
62
     /** how much this pointer has moved, in space units, since its tracking began */
62
     /** how much this pointer has moved, in space units, since its tracking began */
63
-    readonly totalDistance: number;
63
+    readonly movementLength: number;
64
 
64
 
65
     /** whether or not this is the primary pointer for this type */
65
     /** whether or not this is the primary pointer for this type */
66
     readonly isPrimary: boolean;
66
     readonly isPrimary: boolean;

正在加载...
取消
保存