Przeglądaj źródła

Add TrackablePointer.isPrimary flag

customisations
alemart 10 miesięcy temu
rodzic
commit
ab17a40297
1 zmienionych plików z 7 dodań i 1 usunięć
  1. 7
    1
      src/trackers/pointer-tracker/pointer-tracker.ts

+ 7
- 1
src/trackers/pointer-tracker/pointer-tracker.ts Wyświetl plik

@@ -53,6 +53,9 @@ export interface TrackablePointer extends Trackable
53 53
     /** the first position, given in normalized coordinates */
54 54
     readonly initialPosition: Vector2;
55 55
 
56
+    /** whether or not this is the primary pointer for this type */
57
+    readonly isPrimary: boolean;
58
+
56 59
     /** the type of the originating device; typically "mouse", "touch" or "pen" */
57 60
     readonly type: string;
58 61
 }
@@ -283,9 +286,12 @@ export class PointerTracker implements Tracker
283 286
             // determine the type of the originating device
284 287
             const type = event.pointerType;
285 288
 
289
+            // determine whether or not this is the primary pointer for this type
290
+            const isPrimary = event.isPrimary;
291
+
286 292
             // we create new trackable instances on each frame;
287 293
             // these will be exported and consumed by the user
288
-            this._newPointers.set(id, { id, phase, position, initialPosition, type });
294
+            this._newPointers.set(id, { id, phase, position, initialPosition, isPrimary, type });
289 295
 
290 296
         }
291 297
 

Ładowanie…
Anuluj
Zapisz