소스 검색

Rename TrackablePointer.totalDistance to TrackablePointer.movementLength

customisations
alemart 9 달 전
부모
커밋
ec2a3e01f5
3개의 변경된 파일6개의 추가작업 그리고 6개의 파일을 삭제
  1. 3
    3
      docs/api/trackable-pointer.md
  2. 2
    2
      src/trackers/pointer-tracker/pointer-tracker.ts
  3. 1
    1
      src/trackers/pointer-tracker/trackable-pointer.ts

+ 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;

Loading…
취소
저장