Sfoglia il codice sorgente

Introduce Trackable.tracker

customisations
alemart 8 mesi fa
parent
commit
cbf1d1120a

+ 11
- 1
docs/api/trackable.md Vedi File

1
 # Trackable
1
 # Trackable
2
 
2
 
3
-A Trackable is an interface that represents something that is tracked by a [Tracker](tracker.md).
3
+A Trackable is an interface that represents something that is tracked by a [Tracker](tracker.md).
4
+
5
+## Properties
6
+
7
+### tracker
8
+
9
+`trackable.tracker: Tracker, read-only`
10
+
11
+A reference to the [Tracker](tracker.md) that generated this trackable.
12
+
13
+*Since:* 0.4.0

+ 2
- 1
src/trackers/image-tracker/states/tracking.ts Vedi File

376
             // the trackable object
376
             // the trackable object
377
             const trackable: TrackableImage = {
377
             const trackable: TrackableImage = {
378
                 pose: pose,
378
                 pose: pose,
379
-                referenceImage: referenceImage
379
+                referenceImage: referenceImage,
380
+                tracker: this._imageTracker
380
             };
381
             };
381
 
382
 
382
             // the result generated by the image tracker
383
             // the result generated by the image tracker

+ 8
- 1
src/trackers/pointer-tracker/pointer-tracker.ts Vedi File

394
 
394
 
395
             // we create new trackable instances on each frame;
395
             // we create new trackable instances on each frame;
396
             // these will be exported and consumed by the user
396
             // these will be exported and consumed by the user
397
-            this._newPointers.set(id, { id, phase, position, deltaPosition, initialPosition, velocity, duration, movementDuration, movementLength, isPrimary, kind });
397
+            this._newPointers.set(id, {
398
+                id, phase,
399
+                position, deltaPosition, initialPosition,
400
+                velocity, duration,
401
+                movementDuration, movementLength,
402
+                isPrimary, kind,
403
+                tracker: this
404
+            });
398
 
405
 
399
         }
406
         }
400
 
407
 

+ 2
- 0
src/trackers/tracker.ts Vedi File

29
  */
29
  */
30
 export interface Trackable
30
 export interface Trackable
31
 {
31
 {
32
+    /** the tracker that generated this trackable */
33
+    readonly tracker: Tracker;
32
 }
34
 }
33
 
35
 
34
 /**
36
 /**

Loading…
Annulla
Salva