@iwsdk/xr-input 1.2.0-rc.0 → 1.2.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/pointer/multi-pointer.d.ts +69 -2
- package/dist/pointer/multi-pointer.d.ts.map +1 -1
- package/dist/pointer/multi-pointer.js +134 -7
- package/dist/pointer/multi-pointer.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/xr-input-manager.d.ts.map +1 -1
- package/dist/xr-input-manager.js +6 -0
- package/dist/xr-input-manager.js.map +1 -1
- package/package.json +1 -1
|
@@ -13,6 +13,13 @@ export interface MultiPointerInput {
|
|
|
13
13
|
selectEnd?: boolean;
|
|
14
14
|
squeezeStart?: boolean;
|
|
15
15
|
squeezeEnd?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Whether the squeeze is held this frame. When `false`, a grab selection
|
|
18
|
+
* ends even without a `squeezeEnd` edge, for example after the input source
|
|
19
|
+
* switched from a controller to a hand mid-squeeze. Leave it undefined to
|
|
20
|
+
* rely on the edges alone.
|
|
21
|
+
*/
|
|
22
|
+
squeezing?: boolean;
|
|
16
23
|
/**
|
|
17
24
|
* Temporarily disable the far ray without changing its registration.
|
|
18
25
|
* Gaze mode uses this to make the hand/controller ray a fallback while
|
|
@@ -59,6 +66,16 @@ export declare class MultiPointer {
|
|
|
59
66
|
private pointerStates;
|
|
60
67
|
/** Hysteresis tracking: whether touch is currently in hover state */
|
|
61
68
|
private touchHoverActive;
|
|
69
|
+
/**
|
|
70
|
+
* Set while a touch press cancelled by a grab (a squeeze, or a pinch routed
|
|
71
|
+
* to the grab pointer) waits for the tip to lift off. Until then the touch
|
|
72
|
+
* pointer isn't moved, so it neither hovers nor presses, as a browser makes
|
|
73
|
+
* a cancelled touch lift before it can press again. A tip still on the
|
|
74
|
+
* surface when the grab ends (always the case for a pokeable grabbable the
|
|
75
|
+
* tip pressed) would otherwise press it again at once, and pulling away
|
|
76
|
+
* would click it.
|
|
77
|
+
*/
|
|
78
|
+
private touchLiftPending;
|
|
62
79
|
/** Cached scene reference with type-specific descendants */
|
|
63
80
|
private sceneWithDescendants;
|
|
64
81
|
/** Reusable native event object to avoid per-frame allocations */
|
|
@@ -67,8 +84,9 @@ export declare class MultiPointer {
|
|
|
67
84
|
private readonly rayPolicy;
|
|
68
85
|
/**
|
|
69
86
|
* Pointers that completed the upstream library's first ready move. Mirrors
|
|
70
|
-
* its private `wasMoved` latch
|
|
71
|
-
*
|
|
87
|
+
* its private `wasMoved` latch. Only `Pointer.exit()` resets that latch,
|
|
88
|
+
* and MultiPointer calls it only in `releaseTouchForGrab()`, which removes
|
|
89
|
+
* the touch pointer from this set too.
|
|
72
90
|
*/
|
|
73
91
|
private readonly movedPointers;
|
|
74
92
|
/** Reusable event object for pointer down/up with button */
|
|
@@ -105,6 +123,55 @@ export declare class MultiPointer {
|
|
|
105
123
|
* Check if a pointer has a valid candidate (intersection)
|
|
106
124
|
*/
|
|
107
125
|
private hasValidCandidate;
|
|
126
|
+
/**
|
|
127
|
+
* Touch outranks grab so a fingertip or controller tip can press a pokeable,
|
|
128
|
+
* but only the active pointer's lifecycle runs and only the grab pointer
|
|
129
|
+
* takes the squeeze. Without this, any pokeable within touch range (or the
|
|
130
|
+
* grabbable itself, when it is also pokeable) swallows every squeeze. A
|
|
131
|
+
* squeeze is a grab intent, so the grab pointer takes over whenever its
|
|
132
|
+
* sphere has a target, even from a touch press, which it cancels. A ray
|
|
133
|
+
* selection keeps its lock: its trigger release only reaches it while it is
|
|
134
|
+
* the active pointer.
|
|
135
|
+
*/
|
|
136
|
+
private preferGrabOnSqueeze;
|
|
137
|
+
/** Whether the grab sphere touches something a squeeze or pinch can grab. */
|
|
138
|
+
private grabHasTarget;
|
|
139
|
+
/**
|
|
140
|
+
* Ends what the touch pointer is doing when a grab takes the hand over.
|
|
141
|
+
*
|
|
142
|
+
* A press is cancelled. Left alone, it would hold the poked object pressed
|
|
143
|
+
* (`Pressed`, UIKit active) through the grab, and lifting the tip after a
|
|
144
|
+
* short grab would still click it. As when a browser cancels a touch, the
|
|
145
|
+
* object gets pointercancel, then pointerout and pointerleave from `exit()`,
|
|
146
|
+
* and no pointerup or click. The touch pointer then waits for the tip to
|
|
147
|
+
* lift off (`touchLiftPending`) before it hovers or presses again.
|
|
148
|
+
*
|
|
149
|
+
* With `endHover`, a touch pointer that only hovers something gets the
|
|
150
|
+
* leave events from `exit()` too, without the lift-off wait. A squeeze grab
|
|
151
|
+
* passes it because its lock freezes the touch pointer. A routed pinch
|
|
152
|
+
* doesn't: the touch pointer keeps moving through a pinch grab, so its
|
|
153
|
+
* hover stays current.
|
|
154
|
+
*
|
|
155
|
+
* A touch pointer that touches nothing is left alone. Its button is down
|
|
156
|
+
* then too: with no pokeable in reach, its hit is the scene's void object at
|
|
157
|
+
* distance 0, which is within `downRadius`. Cancelling that press would send
|
|
158
|
+
* pointercancel, pointerout and pointerleave to the void object, which
|
|
159
|
+
* bubble to the scene, and start a lift-off wait for nothing.
|
|
160
|
+
*
|
|
161
|
+
* In pointer-events 6.6.32, `cancel()` clears the pressed button, its click
|
|
162
|
+
* time and any capture. In 6.6.28 it only emits pointercancel and leaves
|
|
163
|
+
* the button down, and `exit()` doesn't clear it either: `exit()` drops the
|
|
164
|
+
* intersection and capture and commits. The touch pointer's move callback
|
|
165
|
+
* (from `createTouchPointer`), which that commit runs, then sees no contact
|
|
166
|
+
* and calls `up()`, which clears the button and emits nothing without an
|
|
167
|
+
* intersection.
|
|
168
|
+
*/
|
|
169
|
+
private releaseTouchForGrab;
|
|
170
|
+
/**
|
|
171
|
+
* Whether the touch tip is within press distance of a pokeable. Probes
|
|
172
|
+
* without moving the touch pointer, so it emits no events.
|
|
173
|
+
*/
|
|
174
|
+
private isTouchTipDown;
|
|
108
175
|
/**
|
|
109
176
|
* Switch active pointer to a new kind
|
|
110
177
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multi-pointer.d.ts","sourceRoot":"","sources":["../../src/pointer/multi-pointer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AACvE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAMpD,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC;AAEnD,MAAM,WAAW,iBAAiB;IAChC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;GAEG;AACH,oBAAY,eAAe;IACzB,4CAA4C;IAC5C,QAAQ,aAAa;IACrB,oCAAoC;IACpC,MAAM,WAAW;IACjB,kDAAkD;IAClD,KAAK,UAAU;IACf,wCAAwC;IACxC,MAAM,WAAW;CAClB;AAuBD;;;;;;;;;;GAUG;AACH,qBAAa,YAAY;
|
|
1
|
+
{"version":3,"file":"multi-pointer.d.ts","sourceRoot":"","sources":["../../src/pointer/multi-pointer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AACvE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAMpD,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC;AAEnD,MAAM,WAAW,iBAAiB;IAChC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CA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G,OAAO,GAAG,IAAI;IA0B5E;;OAEG;IACH,gBAAgB,IAAI,OAAO,GAAG,IAAI;IAOlC;;OAEG;IACH,UAAU,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO;IAItC;;;OAGG;IACH,SAAS,CACP,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,EACrC,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,QAAQ,EACjC,WAAW,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE;IAiBpC;;;OAGG;IACH,OAAO,CACL,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,EACrC,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,QAAQ,EACjC,WAAW,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE;IAUpC;;OAEG;IACH,OAAO,CAAC,UAAU;IAuBlB;;OAEG;IACH,OAAO,CAAC,QAAQ;IAahB;;;OAGG;IACH,OAAO,IAAI,IAAI;CAWhB"}
|
|
@@ -2,7 +2,7 @@ import { Vector3 } from 'three';
|
|
|
2
2
|
import { CursorVisual } from './cursor-visual.js';
|
|
3
3
|
import { GrabPointer } from './grab-pointer.js';
|
|
4
4
|
import { RayPointer } from './ray-pointer.js';
|
|
5
|
-
import { TouchPointer } from './touch-pointer.js';
|
|
5
|
+
import { TouchPointer, TOUCH_DEFAULTS } from './touch-pointer.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
@@ -59,14 +59,25 @@ class MultiPointer {
|
|
|
59
59
|
this.pointerStates = new Map();
|
|
60
60
|
/** Hysteresis tracking: whether touch is currently in hover state */
|
|
61
61
|
this.touchHoverActive = false;
|
|
62
|
+
/**
|
|
63
|
+
* Set while a touch press cancelled by a grab (a squeeze, or a pinch routed
|
|
64
|
+
* to the grab pointer) waits for the tip to lift off. Until then the touch
|
|
65
|
+
* pointer isn't moved, so it neither hovers nor presses, as a browser makes
|
|
66
|
+
* a cancelled touch lift before it can press again. A tip still on the
|
|
67
|
+
* surface when the grab ends (always the case for a pokeable grabbable the
|
|
68
|
+
* tip pressed) would otherwise press it again at once, and pulling away
|
|
69
|
+
* would click it.
|
|
70
|
+
*/
|
|
71
|
+
this.touchLiftPending = false;
|
|
62
72
|
/** Reusable native event object to avoid per-frame allocations */
|
|
63
73
|
this.nativeEvent = { timeStamp: 0 };
|
|
64
74
|
/** Reusable policy object for ray rendering */
|
|
65
75
|
this.rayPolicy = { forceHideRay: false };
|
|
66
76
|
/**
|
|
67
77
|
* Pointers that completed the upstream library's first ready move. Mirrors
|
|
68
|
-
* its private `wasMoved` latch
|
|
69
|
-
*
|
|
78
|
+
* its private `wasMoved` latch. Only `Pointer.exit()` resets that latch,
|
|
79
|
+
* and MultiPointer calls it only in `releaseTouchForGrab()`, which removes
|
|
80
|
+
* the touch pointer from this set too.
|
|
70
81
|
*/
|
|
71
82
|
this.movedPointers = new Set();
|
|
72
83
|
/** Reusable event object for pointer down/up with button */
|
|
@@ -130,6 +141,16 @@ class MultiPointer {
|
|
|
130
141
|
if (activePointer && this.activeKind) {
|
|
131
142
|
this.movePointerWithDescendants(this.activeKind, activePointer);
|
|
132
143
|
}
|
|
144
|
+
// A touch press must not freeze the grab pointer: a squeeze or pinch
|
|
145
|
+
// grabs what the grab sphere touches now, and an object held by a pinch
|
|
146
|
+
// keeps following the hand while its fingertip presses something.
|
|
147
|
+
if (this.activeKind === 'touch' &&
|
|
148
|
+
this.pointerStates.get('grab') !== InteractorState.DISABLED) {
|
|
149
|
+
this.movePointerWithDescendants('grab', this.grab.pointer);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
if (input === null || input === void 0 ? void 0 : input.squeezeStart) {
|
|
153
|
+
this.preferGrabOnSqueeze();
|
|
133
154
|
}
|
|
134
155
|
// Phase 5: Process lifecycle (state transitions)
|
|
135
156
|
this.processLifecycle(input);
|
|
@@ -235,8 +256,13 @@ class MultiPointer {
|
|
|
235
256
|
if (this.pointerStates.get('touch') !== InteractorState.DISABLED) {
|
|
236
257
|
this.sceneWithDescendants.interactableDescendants =
|
|
237
258
|
this.touchCandidates();
|
|
238
|
-
|
|
239
|
-
|
|
259
|
+
if (this.touchLiftPending) {
|
|
260
|
+
this.touchLiftPending = this.isTouchTipDown();
|
|
261
|
+
}
|
|
262
|
+
if (!this.touchLiftPending) {
|
|
263
|
+
this.touch.pointer.move(this.scene, this.nativeEvent);
|
|
264
|
+
this.markPointerMoved('touch', this.touch.pointer);
|
|
265
|
+
}
|
|
240
266
|
}
|
|
241
267
|
// Restore original descendants
|
|
242
268
|
this.sceneWithDescendants.interactableDescendants = originalDescendants;
|
|
@@ -325,6 +351,98 @@ class MultiPointer {
|
|
|
325
351
|
// For ray and grab, any valid intersection is a candidate
|
|
326
352
|
return true;
|
|
327
353
|
}
|
|
354
|
+
/**
|
|
355
|
+
* Touch outranks grab so a fingertip or controller tip can press a pokeable,
|
|
356
|
+
* but only the active pointer's lifecycle runs and only the grab pointer
|
|
357
|
+
* takes the squeeze. Without this, any pokeable within touch range (or the
|
|
358
|
+
* grabbable itself, when it is also pokeable) swallows every squeeze. A
|
|
359
|
+
* squeeze is a grab intent, so the grab pointer takes over whenever its
|
|
360
|
+
* sphere has a target, even from a touch press, which it cancels. A ray
|
|
361
|
+
* selection keeps its lock: its trigger release only reaches it while it is
|
|
362
|
+
* the active pointer.
|
|
363
|
+
*/
|
|
364
|
+
preferGrabOnSqueeze() {
|
|
365
|
+
if (this.pointerStates.get('ray') === InteractorState.SELECT ||
|
|
366
|
+
this.pointerStates.get('grab') === InteractorState.SELECT ||
|
|
367
|
+
!this.grabHasTarget()) {
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
// The grab's selection lock stops moving the touch pointer until the
|
|
371
|
+
// squeeze ends, so end its hover too, even when grab was already active
|
|
372
|
+
// (the touch sphere reaches farther than the distance at which touch
|
|
373
|
+
// becomes active). Otherwise a pokeable the tip passed stays `Hovered`
|
|
374
|
+
// through the whole grab.
|
|
375
|
+
this.releaseTouchForGrab(true);
|
|
376
|
+
if (this.activeKind !== 'grab') {
|
|
377
|
+
this.switchActivePointer('grab');
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
/** Whether the grab sphere touches something a squeeze or pinch can grab. */
|
|
381
|
+
grabHasTarget() {
|
|
382
|
+
return (this.pointerStates.get('grab') !== InteractorState.DISABLED &&
|
|
383
|
+
this.hasValidCandidate('grab'));
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Ends what the touch pointer is doing when a grab takes the hand over.
|
|
387
|
+
*
|
|
388
|
+
* A press is cancelled. Left alone, it would hold the poked object pressed
|
|
389
|
+
* (`Pressed`, UIKit active) through the grab, and lifting the tip after a
|
|
390
|
+
* short grab would still click it. As when a browser cancels a touch, the
|
|
391
|
+
* object gets pointercancel, then pointerout and pointerleave from `exit()`,
|
|
392
|
+
* and no pointerup or click. The touch pointer then waits for the tip to
|
|
393
|
+
* lift off (`touchLiftPending`) before it hovers or presses again.
|
|
394
|
+
*
|
|
395
|
+
* With `endHover`, a touch pointer that only hovers something gets the
|
|
396
|
+
* leave events from `exit()` too, without the lift-off wait. A squeeze grab
|
|
397
|
+
* passes it because its lock freezes the touch pointer. A routed pinch
|
|
398
|
+
* doesn't: the touch pointer keeps moving through a pinch grab, so its
|
|
399
|
+
* hover stays current.
|
|
400
|
+
*
|
|
401
|
+
* A touch pointer that touches nothing is left alone. Its button is down
|
|
402
|
+
* then too: with no pokeable in reach, its hit is the scene's void object at
|
|
403
|
+
* distance 0, which is within `downRadius`. Cancelling that press would send
|
|
404
|
+
* pointercancel, pointerout and pointerleave to the void object, which
|
|
405
|
+
* bubble to the scene, and start a lift-off wait for nothing.
|
|
406
|
+
*
|
|
407
|
+
* In pointer-events 6.6.32, `cancel()` clears the pressed button, its click
|
|
408
|
+
* time and any capture. In 6.6.28 it only emits pointercancel and leaves
|
|
409
|
+
* the button down, and `exit()` doesn't clear it either: `exit()` drops the
|
|
410
|
+
* intersection and capture and commits. The touch pointer's move callback
|
|
411
|
+
* (from `createTouchPointer`), which that commit runs, then sees no contact
|
|
412
|
+
* and calls `up()`, which clears the button and emits nothing without an
|
|
413
|
+
* intersection.
|
|
414
|
+
*/
|
|
415
|
+
releaseTouchForGrab(endHover) {
|
|
416
|
+
if (this.pointerStates.get('touch') === InteractorState.DISABLED) {
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
const touch = this.touch.pointer;
|
|
420
|
+
const intersection = touch.getIntersection();
|
|
421
|
+
if (!intersection || intersection.object.isVoidObject) {
|
|
422
|
+
return;
|
|
423
|
+
}
|
|
424
|
+
const pressing = touch.getButtonsDown().size > 0;
|
|
425
|
+
if (pressing) {
|
|
426
|
+
touch.cancel(this.nativeEvent);
|
|
427
|
+
}
|
|
428
|
+
else if (!endHover) {
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
touch.exit(this.nativeEvent);
|
|
432
|
+
this.movedPointers.delete('touch');
|
|
433
|
+
this.touchHoverActive = false;
|
|
434
|
+
this.touchLiftPending = pressing;
|
|
435
|
+
this.pointerStates.set('touch', InteractorState.NORMAL);
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Whether the touch tip is within press distance of a pokeable. Probes
|
|
439
|
+
* without moving the touch pointer, so it emits no events.
|
|
440
|
+
*/
|
|
441
|
+
isTouchTipDown() {
|
|
442
|
+
const intersection = this.touch.pointer.computeIntersection('pointer', this.scene, this.nativeEvent);
|
|
443
|
+
return (!intersection.object.isVoidObject &&
|
|
444
|
+
intersection.distance <= TOUCH_DEFAULTS.downRadius);
|
|
445
|
+
}
|
|
328
446
|
/**
|
|
329
447
|
* Switch active pointer to a new kind
|
|
330
448
|
*/
|
|
@@ -360,8 +478,10 @@ class MultiPointer {
|
|
|
360
478
|
this.processTouchLifecycle(entry, state);
|
|
361
479
|
break;
|
|
362
480
|
case 'grab':
|
|
363
|
-
// Grab uses squeeze button
|
|
364
|
-
|
|
481
|
+
// Grab uses squeeze button. A squeeze no longer held also ends the
|
|
482
|
+
// grab: a source that stops reporting it (a hand that replaces the
|
|
483
|
+
// controller mid-squeeze) never sends squeezeEnd.
|
|
484
|
+
this.processButtonLifecycle(entry, state, !!(input === null || input === void 0 ? void 0 : input.squeezeStart), !!(input === null || input === void 0 ? void 0 : input.squeezeEnd) || (input === null || input === void 0 ? void 0 : input.squeezing) === false, 2);
|
|
365
485
|
break;
|
|
366
486
|
case 'ray':
|
|
367
487
|
// Ray uses select button
|
|
@@ -544,6 +664,13 @@ class MultiPointer {
|
|
|
544
664
|
if (!ptr) {
|
|
545
665
|
return;
|
|
546
666
|
}
|
|
667
|
+
// A down routed to the grab pointer (a hand pinch) grabs what the grab
|
|
668
|
+
// sphere touches, so it cancels a fingertip press the way a squeeze does.
|
|
669
|
+
// The pinch doesn't take the selection lock, so the touch pointer keeps
|
|
670
|
+
// moving and a mere hover stays.
|
|
671
|
+
if (target === 'grab' && this.grabHasTarget()) {
|
|
672
|
+
this.releaseTouchForGrab(false);
|
|
673
|
+
}
|
|
547
674
|
const button = kind === 'select' ? 0 : 2;
|
|
548
675
|
ptr.down({ button, timeStamp: nativeEvent.timeStamp });
|
|
549
676
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multi-pointer.js","sources":["../../src/pointer/multi-pointer.ts"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { Pointer } from '@pmndrs/pointer-events';\nimport { Vector3, type Object3D, type PerspectiveCamera } from 'three';\nimport type { XROrigin } from '../rig/xr-origin.js';\nimport { CursorVisual } from './cursor-visual.js';\nimport { GrabPointer } from './grab-pointer.js';\nimport { RayPointer } from './ray-pointer.js';\nimport { TouchPointer } from './touch-pointer.js';\n\nexport type PointerKind = 'ray' | 'grab' | 'touch';\n\nexport interface MultiPointerInput {\n selectStart?: boolean;\n selectEnd?: boolean;\n squeezeStart?: boolean;\n squeezeEnd?: boolean;\n /**\n * Temporarily disable the far ray without changing its registration.\n * Gaze mode uses this to make the hand/controller ray a fallback while\n * leaving near touch and grab interaction available.\n */\n suppressRay?: boolean;\n}\n\n/**\n * Interactor state machine states\n */\nexport enum InteractorState {\n /** Pointer not registered or not enabled */\n DISABLED = 'disabled',\n /** Pointer enabled, no candidate */\n NORMAL = 'normal',\n /** Pointer has candidate, hovering over object */\n HOVER = 'hover',\n /** Pointer actively selecting object */\n SELECT = 'select',\n}\n\n/**\n * Priority order for pointer types (lower index = higher priority)\n */\nconst PRIORITY_ORDER: PointerKind[] = ['touch', 'grab', 'ray'];\n\n/**\n * Hysteresis thresholds for touch pointer (in meters)\n */\nconst TOUCH_HYSTERESIS = {\n enterHoverDistance: 0.15, // 15cm - distance to start hover\n exitHoverDistance: 0.2, // 20cm - distance to end hover\n};\n\nconst TOUCH_VISUAL_OFFSET_EPSILON_SQ = 0.000001;\n\ntype PointerEntry<T> = {\n pointer: Pointer;\n visual: T;\n registered: boolean;\n};\n\n/**\n * MultiPointer orchestrates multiple pointer types using priority-based selection.\n *\n * @remarks\n * - Priority order: Touch > Grab > Ray\n * - Uses state machine: DISABLED ↔ NORMAL ↔ HOVER ↔ SELECT\n * - Selection lock: Once a pointer starts selecting, it stays locked until release\n * - Hysteresis: Touch pointer uses separate enter/exit thresholds to prevent flickering\n *\n * @category Pointer\n */\nexport class MultiPointer {\n private ray: PointerEntry<RayPointer>;\n private grab: PointerEntry<GrabPointer>;\n private touch: PointerEntry<TouchPointer>;\n private cursorVisual: CursorVisual;\n\n /** Current active pointer kind (winner of priority selection) */\n private activeKind: PointerKind | null = null;\n\n /** State for each pointer type */\n private pointerStates: Map<PointerKind, InteractorState> = new Map();\n\n /** Hysteresis tracking: whether touch is currently in hover state */\n private touchHoverActive = false;\n\n /** Cached scene reference with type-specific descendants */\n private sceneWithDescendants: {\n interactableDescendants?: Object3D[];\n rayDescendants?: Object3D[];\n touchDescendants?: Object3D[];\n /** Touch descendants per hand; preferred over touchDescendants when set. */\n touchDescendantsByHand?: { left: Object3D[]; right: Object3D[] };\n grabDescendants?: Object3D[];\n };\n\n /** Reusable native event object to avoid per-frame allocations */\n private readonly nativeEvent = { timeStamp: 0 };\n\n /** Reusable policy object for ray rendering */\n private readonly rayPolicy = { forceHideRay: false };\n\n /**\n * Pointers that completed the upstream library's first ready move. Mirrors\n * its private `wasMoved` latch; neither latch is reset because MultiPointer\n * never calls `Pointer.exit()` on these long-lived instances.\n */\n private readonly movedPointers = new Set<PointerKind>();\n\n /** Reusable event object for pointer down/up with button */\n private readonly buttonEvent = { timeStamp: 0, button: 0 };\n\n constructor(\n private readonly handedness: 'left' | 'right',\n private readonly scene: Object3D,\n private readonly camera: PerspectiveCamera,\n private readonly xrOrigin: XROrigin,\n ) {\n // Create all pointer instances\n const rayVisual = new RayPointer(\n this.camera,\n this.xrOrigin,\n this.handedness,\n );\n const grabVisual = new GrabPointer(\n this.camera,\n this.xrOrigin,\n this.handedness,\n );\n const touchVisual = new TouchPointer(\n this.camera,\n this.xrOrigin,\n this.handedness,\n );\n\n this.ray = {\n pointer: rayVisual.pointer,\n visual: rayVisual,\n registered: false,\n };\n this.grab = {\n pointer: grabVisual.pointer,\n visual: grabVisual,\n registered: false,\n };\n this.touch = {\n pointer: touchVisual.pointer,\n visual: touchVisual,\n registered: false,\n };\n\n // Cache scene reference for descendant swapping (avoids repeated casts)\n this.sceneWithDescendants = this.scene as typeof this.sceneWithDescendants;\n\n // Create shared cursor visual\n this.cursorVisual = new CursorVisual(\n xrOrigin,\n handedness === 'left' ? 0 : 1,\n );\n\n // Initialize states\n PRIORITY_ORDER.forEach((kind) => {\n this.pointerStates.set(kind, InteractorState.DISABLED);\n });\n\n // Enable ray and touch by default\n this.toggleSubPointer('ray', true);\n this.toggleSubPointer('touch', true);\n }\n\n /**\n * Main update loop - implements priority-based pointer selection\n */\n update(\n connected: boolean,\n delta: number,\n time: number,\n input?: MultiPointerInput,\n ) {\n // Reuse nativeEvent object to avoid allocation\n this.nativeEvent.timeStamp = time * 1000;\n\n // Phase 1: Update enabled state for all registered pointers\n const rayConnected = connected && !input?.suppressRay;\n this.updatePointerEnabled(connected, rayConnected);\n\n // Phase 2: Check selection lock - if active pointer is selecting, stay locked\n const activePointer = this.getActivePointer();\n const activeState = activePointer\n ? this.pointerStates.get(this.activeKind!)\n : null;\n const isSelecting = activeState === InteractorState.SELECT;\n\n if (!isSelecting) {\n // Phase 3: Compute intersections for all enabled pointers\n this.computeAllIntersections();\n\n // Phase 4: Pick winner by priority\n this.pickActiveByPriority();\n } else {\n // Selection locked - only update the active pointer's intersection\n // Still use type-specific descendants for the locked pointer\n if (activePointer && this.activeKind) {\n this.movePointerWithDescendants(this.activeKind, activePointer);\n }\n }\n\n // Phase 5: Process lifecycle (state transitions)\n this.processLifecycle(input);\n\n // Phase 6: Update shared cursor from active pointer\n const anyPointerHasCapture =\n !!this.ray.pointer.getPointerCapture?.() ||\n !!this.grab.pointer.getPointerCapture?.() ||\n !!this.touch.pointer.getPointerCapture?.();\n\n if (this.activeKind && !anyPointerHasCapture) {\n const activeEntry = this.getEntry(this.activeKind);\n const intersection = activeEntry.pointer.getIntersection();\n const focused =\n this.pointerStates.get(this.activeKind) === InteractorState.SELECT;\n const visible = !!intersection && !intersection.object.isVoidObject;\n\n this.cursorVisual.setVisible(visible);\n if (visible && intersection) {\n this.cursorVisual.updateFromIntersection(intersection, delta, focused);\n }\n } else {\n this.cursorVisual.setVisible(false);\n }\n\n // Phase 7: Update visuals - reuse rayPolicy object\n this.rayPolicy.forceHideRay = this.shouldHideRay();\n this.ray.visual.update(\n rayConnected && this.ray.registered,\n delta,\n time,\n !!input?.selectStart,\n !!input?.selectEnd,\n this.rayPolicy,\n );\n this.grab.visual.update(\n connected && this.grab.registered,\n delta,\n time,\n !!input?.squeezeStart,\n !!input?.squeezeEnd,\n );\n this.touch.visual.update(\n connected && this.touch.registered,\n delta,\n time,\n false,\n false,\n );\n }\n\n /**\n * Update enabled state for all registered pointers\n */\n private updatePointerEnabled(connected: boolean, rayConnected: boolean) {\n // Process ray pointer\n this.updateSinglePointerEnabled('ray', this.ray, rayConnected);\n // Process grab pointer\n this.updateSinglePointerEnabled('grab', this.grab, connected);\n // Process touch pointer\n this.updateSinglePointerEnabled('touch', this.touch, connected);\n }\n\n /**\n * Update enabled state for a single pointer (avoids array allocation)\n */\n private updateSinglePointerEnabled(\n kind: PointerKind,\n entry: PointerEntry<RayPointer | GrabPointer | TouchPointer>,\n connected: boolean,\n ) {\n const shouldBeEnabled = connected && entry.registered;\n const currentState = this.pointerStates.get(kind)!;\n const isEnabled = currentState !== InteractorState.DISABLED;\n\n if (shouldBeEnabled && !isEnabled) {\n entry.pointer.setEnabled(true, this.nativeEvent, false);\n this.pointerStates.set(kind, InteractorState.NORMAL);\n } else if (!shouldBeEnabled) {\n // Pointer instances start enabled upstream, so also consult the pointer\n // itself. This makes first-frame gaze suppression a real disable rather\n // than merely skipping the ray's intersection pass.\n if (entry.pointer.getEnabled()) {\n const buttonsDown = [...entry.pointer.getButtonsDown()];\n if (buttonsDown.length > 0) {\n // Mode switches terminate an in-flight far selection instead of\n // leaving a stale button/capture that could revive with ray fallback.\n if (!this.movedPointers.has(kind)) {\n // Flush an upstream down queued before the pointer's first move so\n // its matching cancel cannot be stranded in the same queue. In\n // normal updates move() has already run, avoiding callback\n // re-entry on this disable path.\n entry.pointer.commit(this.nativeEvent, false);\n this.movedPointers.add(kind);\n }\n entry.pointer.cancel(this.nativeEvent);\n }\n entry.pointer.setEnabled(false, this.nativeEvent, true);\n for (const button of buttonsDown) {\n entry.pointer.up({ button, timeStamp: this.nativeEvent.timeStamp });\n }\n }\n this.pointerStates.set(kind, InteractorState.DISABLED);\n // Clear active if this was the active pointer\n if (this.activeKind === kind) {\n this.activeKind = null;\n }\n }\n }\n\n /**\n * Compute intersections for all enabled pointers using type-specific descendant arrays.\n * Swaps scene.interactableDescendants per pointer type for optimized traversal.\n */\n private computeAllIntersections() {\n // Store original descendants once\n const originalDescendants =\n this.sceneWithDescendants.interactableDescendants;\n\n // Process each pointer with its type-specific descendants\n // Ray pointer\n if (this.pointerStates.get('ray') !== InteractorState.DISABLED) {\n this.sceneWithDescendants.interactableDescendants =\n this.sceneWithDescendants.rayDescendants;\n this.ray.pointer.move(this.scene, this.nativeEvent);\n this.markPointerMoved('ray', this.ray.pointer);\n }\n\n // Grab pointer\n if (this.pointerStates.get('grab') !== InteractorState.DISABLED) {\n this.sceneWithDescendants.interactableDescendants =\n this.sceneWithDescendants.grabDescendants;\n this.grab.pointer.move(this.scene, this.nativeEvent);\n this.markPointerMoved('grab', this.grab.pointer);\n }\n\n // Touch pointer\n if (this.pointerStates.get('touch') !== InteractorState.DISABLED) {\n this.sceneWithDescendants.interactableDescendants =\n this.touchCandidates();\n this.touch.pointer.move(this.scene, this.nativeEvent);\n this.markPointerMoved('touch', this.touch.pointer);\n }\n\n // Restore original descendants\n this.sceneWithDescendants.interactableDescendants = originalDescendants;\n }\n\n /**\n * Move a single pointer using its type-specific descendants.\n * Used when selection is locked to avoid unnecessary traversal.\n */\n private movePointerWithDescendants(kind: PointerKind, pointer: Pointer) {\n const originalDescendants =\n this.sceneWithDescendants.interactableDescendants;\n\n switch (kind) {\n case 'ray':\n this.sceneWithDescendants.interactableDescendants =\n this.sceneWithDescendants.rayDescendants;\n break;\n case 'grab':\n this.sceneWithDescendants.interactableDescendants =\n this.sceneWithDescendants.grabDescendants;\n break;\n case 'touch':\n this.sceneWithDescendants.interactableDescendants =\n this.touchCandidates();\n break;\n }\n\n pointer.move(this.scene, this.nativeEvent);\n this.markPointerMoved(kind, pointer);\n this.sceneWithDescendants.interactableDescendants = originalDescendants;\n }\n\n private markPointerMoved(kind: PointerKind, pointer: Pointer): void {\n if (pointer.intersector.isReady()) {\n this.movedPointers.add(kind);\n }\n }\n\n /**\n * Pick active pointer by priority - first with valid candidate wins\n */\n private pickActiveByPriority() {\n let newActiveKind: PointerKind | null = null;\n\n for (const kind of PRIORITY_ORDER) {\n const state = this.pointerStates.get(kind)!;\n if (state === InteractorState.DISABLED) {\n continue;\n }\n\n if (this.hasValidCandidate(kind)) {\n newActiveKind = kind;\n break;\n }\n }\n\n // Switch active pointer if changed\n if (newActiveKind !== this.activeKind) {\n this.switchActivePointer(newActiveKind);\n }\n }\n\n /**\n * Check if a pointer has a valid candidate (intersection)\n */\n private hasValidCandidate(kind: PointerKind): boolean {\n const entry = this.getEntry(kind);\n const intersection = entry.pointer.getIntersection();\n\n // No intersection or void object = no candidate\n if (!intersection || intersection.object.isVoidObject) {\n // For touch, update hysteresis state\n if (kind === 'touch') {\n this.touchHoverActive = false;\n }\n return false;\n }\n\n // For touch pointer, apply hysteresis\n if (kind === 'touch') {\n const threshold = this.touchHoverActive\n ? TOUCH_HYSTERESIS.exitHoverDistance\n : TOUCH_HYSTERESIS.enterHoverDistance;\n\n if (intersection.distance > threshold) {\n // Outside threshold\n if (!this.touchHoverActive) {\n return false;\n }\n // Was hovering but now outside exit threshold\n this.touchHoverActive = false;\n return false;\n }\n\n // Within threshold\n this.touchHoverActive = true;\n return true;\n }\n\n // For ray and grab, any valid intersection is a candidate\n return true;\n }\n\n /**\n * Switch active pointer to a new kind\n */\n private switchActivePointer(newKind: PointerKind | null) {\n // Disable previous active pointer (but keep it enabled in the pointer system)\n if (this.activeKind && this.activeKind !== newKind) {\n const prevState = this.pointerStates.get(this.activeKind)!;\n if (prevState === InteractorState.HOVER) {\n this.pointerStates.set(this.activeKind, InteractorState.NORMAL);\n }\n }\n\n this.activeKind = newKind;\n\n // Update new active pointer state\n if (newKind) {\n const state = this.pointerStates.get(newKind)!;\n if (state === InteractorState.NORMAL) {\n this.pointerStates.set(newKind, InteractorState.HOVER);\n }\n }\n }\n\n /**\n * Process lifecycle transitions based on input\n */\n private processLifecycle(input?: MultiPointerInput) {\n if (!this.activeKind) {\n return;\n }\n\n const entry = this.getEntry(this.activeKind);\n const state = this.pointerStates.get(this.activeKind)!;\n\n switch (this.activeKind) {\n case 'touch':\n // Touch auto-selects based on distance\n this.processTouchLifecycle(entry, state);\n break;\n\n case 'grab':\n // Grab uses squeeze button\n this.processButtonLifecycle(\n entry,\n state,\n !!input?.squeezeStart,\n !!input?.squeezeEnd,\n 2, // button 2 for squeeze\n );\n break;\n\n case 'ray':\n // Ray uses select button\n this.processButtonLifecycle(\n entry,\n state,\n !!input?.selectStart,\n !!input?.selectEnd,\n 0, // button 0 for select\n );\n break;\n }\n }\n\n /**\n * Process touch pointer lifecycle - auto-selects based on distance\n */\n private processTouchLifecycle(\n entry: PointerEntry<TouchPointer>,\n state: InteractorState,\n ) {\n const intersection = entry.pointer.getIntersection();\n if (!intersection || intersection.object.isVoidObject) {\n // Lost candidate - transition to NORMAL\n if (state === InteractorState.SELECT) {\n // Force release if touch was selecting when intersection was lost\n this.buttonEvent.timeStamp = this.nativeEvent.timeStamp;\n this.buttonEvent.button = 0;\n entry.pointer.up(this.buttonEvent);\n }\n if (state === InteractorState.HOVER || state === InteractorState.SELECT) {\n this.pointerStates.set('touch', InteractorState.NORMAL);\n }\n return;\n }\n\n // Touch auto-selection is handled by the pointer's onMoveCommited callback\n // (createTouchPointer sets this up). We just need to track the state.\n\n // Check if pointer is currently selecting (has buttons down)\n const isSelecting = entry.pointer.getButtonsDown().size > 0;\n\n if (state === InteractorState.HOVER && isSelecting) {\n this.pointerStates.set('touch', InteractorState.SELECT);\n } else if (state === InteractorState.SELECT && !isSelecting) {\n this.pointerStates.set('touch', InteractorState.HOVER);\n } else if (state === InteractorState.NORMAL) {\n this.pointerStates.set('touch', InteractorState.HOVER);\n }\n }\n\n /**\n * Process button-based pointer lifecycle (ray/grab)\n */\n private processButtonLifecycle(\n entry: PointerEntry<RayPointer | GrabPointer>,\n state: InteractorState,\n buttonDown: boolean,\n buttonUp: boolean,\n button: number,\n ) {\n const intersection = entry.pointer.getIntersection();\n if (!intersection || intersection.object.isVoidObject) {\n // Lost candidate - can happen during selection (pointer capture handles this)\n if (state === InteractorState.HOVER) {\n this.pointerStates.set(this.activeKind!, InteractorState.NORMAL);\n }\n // The selected object went away (e.g. the app disposed it) and the\n // button was released off any target. Release anyway, as the touch\n // lifecycle does, or the selection lock never ends.\n if (state === InteractorState.SELECT && buttonUp) {\n this.buttonEvent.timeStamp = this.nativeEvent.timeStamp;\n this.buttonEvent.button = button;\n entry.pointer.up(this.buttonEvent);\n this.pointerStates.set(this.activeKind!, InteractorState.NORMAL);\n }\n return;\n }\n\n // HOVER → SELECT on button down\n if (state === InteractorState.HOVER && buttonDown) {\n this.buttonEvent.timeStamp = this.nativeEvent.timeStamp;\n this.buttonEvent.button = button;\n entry.pointer.down(this.buttonEvent);\n this.pointerStates.set(this.activeKind!, InteractorState.SELECT);\n }\n // SELECT → HOVER on button up\n else if (state === InteractorState.SELECT && buttonUp) {\n this.buttonEvent.timeStamp = this.nativeEvent.timeStamp;\n this.buttonEvent.button = button;\n entry.pointer.up(this.buttonEvent);\n this.pointerStates.set(this.activeKind!, InteractorState.HOVER);\n }\n // NORMAL → HOVER when we have a candidate\n else if (state === InteractorState.NORMAL) {\n this.pointerStates.set(this.activeKind!, InteractorState.HOVER);\n }\n }\n\n /**\n * Get the policy for ray visual rendering\n */\n /** Objects this hand may poke: its own list when the scene has one. */\n private touchCandidates(): Object3D[] | undefined {\n return (\n this.sceneWithDescendants.touchDescendantsByHand?.[this.handedness] ??\n this.sceneWithDescendants.touchDescendants\n );\n }\n\n getPolicyForRay() {\n return { forceHideRay: this.shouldHideRay() };\n }\n\n private shouldHideRay(): boolean {\n // Hide the visual whenever the ray is disabled or a near pointer owns the\n // hand, including gaze-mode suppression.\n return (\n this.pointerStates.get('ray') === InteractorState.DISABLED ||\n (this.activeKind !== 'ray' && this.activeKind !== null)\n );\n }\n\n /**\n * Check if ray is busy (has intersection)\n */\n getRayBusy(): boolean {\n return !!this.ray.visual.busy;\n }\n\n /**\n * Toggle a sub-pointer on/off\n */\n toggleSubPointer(kind: PointerKind, enabled: boolean): boolean {\n const entry = this.getEntry(kind);\n if (entry.registered === enabled) {\n return false;\n }\n entry.registered = enabled;\n if (!enabled) {\n this.pointerStates.set(kind, InteractorState.DISABLED);\n if (this.activeKind === kind) {\n this.activeKind = null;\n }\n if (kind === 'touch') {\n this.touchHoverActive = false;\n }\n }\n return true;\n }\n\n /**\n * Get the registration state of a sub-pointer\n */\n getSubPointerState(kind: PointerKind): { registered: boolean } {\n const entry = this.getEntry(kind);\n return { registered: entry.registered };\n }\n\n /**\n * Get the currently active pointer kind\n */\n getActiveKind(): PointerKind | null {\n return this.activeKind;\n }\n\n /**\n * Computes a world-space offset that keeps the hand visual's fingertip on the\n * touched surface while the touch pointer is actively selecting.\n */\n getTouchSurfaceVisualOffset(target: Vector3 = new Vector3()): Vector3 | null {\n if (this.activeKind !== 'touch') {\n return null;\n }\n\n if (this.pointerStates.get('touch') !== InteractorState.SELECT) {\n return null;\n }\n\n const intersection = this.touch.pointer.getIntersection();\n if (\n !intersection ||\n intersection.object.isVoidObject ||\n intersection.details.type !== 'sphere'\n ) {\n return null;\n }\n\n target.copy(intersection.pointOnFace).sub(intersection.pointerPosition);\n if (target.lengthSq() < TOUCH_VISUAL_OFFSET_EPSILON_SQ) {\n return null;\n }\n\n return target;\n }\n\n /**\n * Get the currently active pointer\n */\n getActivePointer(): Pointer | null {\n if (!this.activeKind) {\n return null;\n }\n return this.getEntry(this.activeKind).pointer;\n }\n\n /**\n * Get a specific pointer by kind\n */\n getPointer(kind: PointerKind): Pointer {\n return this.getEntry(kind).pointer;\n }\n\n /**\n * Route a down event to a specific pointer target.\n * Used by grab-system for hand pinch gestures.\n */\n routeDown(\n kind: 'select' | 'squeeze' | 'custom',\n target: 'ray' | 'grab' | 'active',\n nativeEvent: { timeStamp: number },\n ) {\n const ptr = this.pickTarget(target);\n if (!ptr) {\n return;\n }\n const button = kind === 'select' ? 0 : 2;\n ptr.down({ button, timeStamp: nativeEvent.timeStamp });\n }\n\n /**\n * Route an up event to a specific pointer target.\n * Used by grab-system for hand pinch gestures.\n */\n routeUp(\n kind: 'select' | 'squeeze' | 'custom',\n target: 'ray' | 'grab' | 'active',\n nativeEvent: { timeStamp: number },\n ) {\n const ptr = this.pickTarget(target);\n if (!ptr) {\n return;\n }\n const button = kind === 'select' ? 0 : 2;\n ptr.up({ button, timeStamp: nativeEvent.timeStamp });\n }\n\n /**\n * Pick pointer by target type.\n */\n private pickTarget(target: 'ray' | 'grab' | 'active'): Pointer | undefined {\n if (target === 'active') {\n // Prefer captured pointer if any, else fall back to active or ray\n if (this.ray.pointer.getPointerCapture?.()) {\n return this.ray.pointer;\n }\n if (this.grab.pointer.getPointerCapture?.()) {\n return this.grab.pointer;\n }\n if (this.touch.pointer.getPointerCapture?.()) {\n return this.touch.pointer;\n }\n // Fall back to active pointer or ray\n return this.activeKind\n ? this.getEntry(this.activeKind).pointer\n : this.ray.pointer;\n }\n if (target === 'ray') {\n return this.ray.pointer;\n }\n return this.grab.pointer;\n }\n\n /**\n * Get the entry for a pointer kind\n */\n private getEntry(\n kind: PointerKind,\n ): PointerEntry<RayPointer | GrabPointer | TouchPointer> {\n switch (kind) {\n case 'ray':\n return this.ray;\n case 'grab':\n return this.grab;\n case 'touch':\n return this.touch;\n }\n }\n\n /**\n * Dispose of all pointer resources.\n * Call this when the MultiPointer is no longer needed.\n */\n dispose(): void {\n // Dispose cursor visual\n this.cursorVisual.dispose();\n\n // Dispose ray pointer (has geometry/material)\n this.ray.visual.dispose();\n\n // Clear state\n this.pointerStates.clear();\n this.activeKind = null;\n }\n}\n"],"names":[],"mappings":";;;;;;AAAA;;;;;AAKG;AAyBH;;AAEG;IACS;AAAZ,CAAA,UAAY,eAAe,EAAA;;AAEzB,IAAA,eAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;;AAErB,IAAA,eAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;;AAEjB,IAAA,eAAA,CAAA,OAAA,CAAA,GAAA,OAAe;;AAEf,IAAA,eAAA,CAAA,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,KAAK,EAAE;AAC1B,QAAA,IAAI,CAAC,UAAU,GAAG,IAAI;IACxB;AACD;;;;"}
|
|
1
|
+
{"version":3,"file":"multi-pointer.js","sources":["../../src/pointer/multi-pointer.ts"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { Pointer } from '@pmndrs/pointer-events';\nimport { Vector3, type Object3D, type PerspectiveCamera } from 'three';\nimport type { XROrigin } from '../rig/xr-origin.js';\nimport { CursorVisual } from './cursor-visual.js';\nimport { GrabPointer } from './grab-pointer.js';\nimport { RayPointer } from './ray-pointer.js';\nimport { TOUCH_DEFAULTS, TouchPointer } from './touch-pointer.js';\n\nexport type PointerKind = 'ray' | 'grab' | 'touch';\n\nexport interface MultiPointerInput {\n selectStart?: boolean;\n selectEnd?: boolean;\n squeezeStart?: boolean;\n squeezeEnd?: boolean;\n /**\n * Whether the squeeze is held this frame. When `false`, a grab selection\n * ends even without a `squeezeEnd` edge, for example after the input source\n * switched from a controller to a hand mid-squeeze. Leave it undefined to\n * rely on the edges alone.\n */\n squeezing?: boolean;\n /**\n * Temporarily disable the far ray without changing its registration.\n * Gaze mode uses this to make the hand/controller ray a fallback while\n * leaving near touch and grab interaction available.\n */\n suppressRay?: boolean;\n}\n\n/**\n * Interactor state machine states\n */\nexport enum InteractorState {\n /** Pointer not registered or not enabled */\n DISABLED = 'disabled',\n /** Pointer enabled, no candidate */\n NORMAL = 'normal',\n /** Pointer has candidate, hovering over object */\n HOVER = 'hover',\n /** Pointer actively selecting object */\n SELECT = 'select',\n}\n\n/**\n * Priority order for pointer types (lower index = higher priority)\n */\nconst PRIORITY_ORDER: PointerKind[] = ['touch', 'grab', 'ray'];\n\n/**\n * Hysteresis thresholds for touch pointer (in meters)\n */\nconst TOUCH_HYSTERESIS = {\n enterHoverDistance: 0.15, // 15cm - distance to start hover\n exitHoverDistance: 0.2, // 20cm - distance to end hover\n};\n\nconst TOUCH_VISUAL_OFFSET_EPSILON_SQ = 0.000001;\n\ntype PointerEntry<T> = {\n pointer: Pointer;\n visual: T;\n registered: boolean;\n};\n\n/**\n * MultiPointer orchestrates multiple pointer types using priority-based selection.\n *\n * @remarks\n * - Priority order: Touch > Grab > Ray\n * - Uses state machine: DISABLED ↔ NORMAL ↔ HOVER ↔ SELECT\n * - Selection lock: Once a pointer starts selecting, it stays locked until release\n * - Hysteresis: Touch pointer uses separate enter/exit thresholds to prevent flickering\n *\n * @category Pointer\n */\nexport class MultiPointer {\n private ray: PointerEntry<RayPointer>;\n private grab: PointerEntry<GrabPointer>;\n private touch: PointerEntry<TouchPointer>;\n private cursorVisual: CursorVisual;\n\n /** Current active pointer kind (winner of priority selection) */\n private activeKind: PointerKind | null = null;\n\n /** State for each pointer type */\n private pointerStates: Map<PointerKind, InteractorState> = new Map();\n\n /** Hysteresis tracking: whether touch is currently in hover state */\n private touchHoverActive = false;\n\n /**\n * Set while a touch press cancelled by a grab (a squeeze, or a pinch routed\n * to the grab pointer) waits for the tip to lift off. Until then the touch\n * pointer isn't moved, so it neither hovers nor presses, as a browser makes\n * a cancelled touch lift before it can press again. A tip still on the\n * surface when the grab ends (always the case for a pokeable grabbable the\n * tip pressed) would otherwise press it again at once, and pulling away\n * would click it.\n */\n private touchLiftPending = false;\n\n /** Cached scene reference with type-specific descendants */\n private sceneWithDescendants: {\n interactableDescendants?: Object3D[];\n rayDescendants?: Object3D[];\n touchDescendants?: Object3D[];\n /** Touch descendants per hand; preferred over touchDescendants when set. */\n touchDescendantsByHand?: { left: Object3D[]; right: Object3D[] };\n grabDescendants?: Object3D[];\n };\n\n /** Reusable native event object to avoid per-frame allocations */\n private readonly nativeEvent = { timeStamp: 0 };\n\n /** Reusable policy object for ray rendering */\n private readonly rayPolicy = { forceHideRay: false };\n\n /**\n * Pointers that completed the upstream library's first ready move. Mirrors\n * its private `wasMoved` latch. Only `Pointer.exit()` resets that latch,\n * and MultiPointer calls it only in `releaseTouchForGrab()`, which removes\n * the touch pointer from this set too.\n */\n private readonly movedPointers = new Set<PointerKind>();\n\n /** Reusable event object for pointer down/up with button */\n private readonly buttonEvent = { timeStamp: 0, button: 0 };\n\n constructor(\n private readonly handedness: 'left' | 'right',\n private readonly scene: Object3D,\n private readonly camera: PerspectiveCamera,\n private readonly xrOrigin: XROrigin,\n ) {\n // Create all pointer instances\n const rayVisual = new RayPointer(\n this.camera,\n this.xrOrigin,\n this.handedness,\n );\n const grabVisual = new GrabPointer(\n this.camera,\n this.xrOrigin,\n this.handedness,\n );\n const touchVisual = new TouchPointer(\n this.camera,\n this.xrOrigin,\n this.handedness,\n );\n\n this.ray = {\n pointer: rayVisual.pointer,\n visual: rayVisual,\n registered: false,\n };\n this.grab = {\n pointer: grabVisual.pointer,\n visual: grabVisual,\n registered: false,\n };\n this.touch = {\n pointer: touchVisual.pointer,\n visual: touchVisual,\n registered: false,\n };\n\n // Cache scene reference for descendant swapping (avoids repeated casts)\n this.sceneWithDescendants = this.scene as typeof this.sceneWithDescendants;\n\n // Create shared cursor visual\n this.cursorVisual = new CursorVisual(\n xrOrigin,\n handedness === 'left' ? 0 : 1,\n );\n\n // Initialize states\n PRIORITY_ORDER.forEach((kind) => {\n this.pointerStates.set(kind, InteractorState.DISABLED);\n });\n\n // Enable ray and touch by default\n this.toggleSubPointer('ray', true);\n this.toggleSubPointer('touch', true);\n }\n\n /**\n * Main update loop - implements priority-based pointer selection\n */\n update(\n connected: boolean,\n delta: number,\n time: number,\n input?: MultiPointerInput,\n ) {\n // Reuse nativeEvent object to avoid allocation\n this.nativeEvent.timeStamp = time * 1000;\n\n // Phase 1: Update enabled state for all registered pointers\n const rayConnected = connected && !input?.suppressRay;\n this.updatePointerEnabled(connected, rayConnected);\n\n // Phase 2: Check selection lock - if active pointer is selecting, stay locked\n const activePointer = this.getActivePointer();\n const activeState = activePointer\n ? this.pointerStates.get(this.activeKind!)\n : null;\n const isSelecting = activeState === InteractorState.SELECT;\n\n if (!isSelecting) {\n // Phase 3: Compute intersections for all enabled pointers\n this.computeAllIntersections();\n\n // Phase 4: Pick winner by priority\n this.pickActiveByPriority();\n } else {\n // Selection locked - only update the active pointer's intersection\n // Still use type-specific descendants for the locked pointer\n if (activePointer && this.activeKind) {\n this.movePointerWithDescendants(this.activeKind, activePointer);\n }\n // A touch press must not freeze the grab pointer: a squeeze or pinch\n // grabs what the grab sphere touches now, and an object held by a pinch\n // keeps following the hand while its fingertip presses something.\n if (\n this.activeKind === 'touch' &&\n this.pointerStates.get('grab') !== InteractorState.DISABLED\n ) {\n this.movePointerWithDescendants('grab', this.grab.pointer);\n }\n }\n\n if (input?.squeezeStart) {\n this.preferGrabOnSqueeze();\n }\n\n // Phase 5: Process lifecycle (state transitions)\n this.processLifecycle(input);\n\n // Phase 6: Update shared cursor from active pointer\n const anyPointerHasCapture =\n !!this.ray.pointer.getPointerCapture?.() ||\n !!this.grab.pointer.getPointerCapture?.() ||\n !!this.touch.pointer.getPointerCapture?.();\n\n if (this.activeKind && !anyPointerHasCapture) {\n const activeEntry = this.getEntry(this.activeKind);\n const intersection = activeEntry.pointer.getIntersection();\n const focused =\n this.pointerStates.get(this.activeKind) === InteractorState.SELECT;\n const visible = !!intersection && !intersection.object.isVoidObject;\n\n this.cursorVisual.setVisible(visible);\n if (visible && intersection) {\n this.cursorVisual.updateFromIntersection(intersection, delta, focused);\n }\n } else {\n this.cursorVisual.setVisible(false);\n }\n\n // Phase 7: Update visuals - reuse rayPolicy object\n this.rayPolicy.forceHideRay = this.shouldHideRay();\n this.ray.visual.update(\n rayConnected && this.ray.registered,\n delta,\n time,\n !!input?.selectStart,\n !!input?.selectEnd,\n this.rayPolicy,\n );\n this.grab.visual.update(\n connected && this.grab.registered,\n delta,\n time,\n !!input?.squeezeStart,\n !!input?.squeezeEnd,\n );\n this.touch.visual.update(\n connected && this.touch.registered,\n delta,\n time,\n false,\n false,\n );\n }\n\n /**\n * Update enabled state for all registered pointers\n */\n private updatePointerEnabled(connected: boolean, rayConnected: boolean) {\n // Process ray pointer\n this.updateSinglePointerEnabled('ray', this.ray, rayConnected);\n // Process grab pointer\n this.updateSinglePointerEnabled('grab', this.grab, connected);\n // Process touch pointer\n this.updateSinglePointerEnabled('touch', this.touch, connected);\n }\n\n /**\n * Update enabled state for a single pointer (avoids array allocation)\n */\n private updateSinglePointerEnabled(\n kind: PointerKind,\n entry: PointerEntry<RayPointer | GrabPointer | TouchPointer>,\n connected: boolean,\n ) {\n const shouldBeEnabled = connected && entry.registered;\n const currentState = this.pointerStates.get(kind)!;\n const isEnabled = currentState !== InteractorState.DISABLED;\n\n if (shouldBeEnabled && !isEnabled) {\n entry.pointer.setEnabled(true, this.nativeEvent, false);\n this.pointerStates.set(kind, InteractorState.NORMAL);\n } else if (!shouldBeEnabled) {\n // Pointer instances start enabled upstream, so also consult the pointer\n // itself. This makes first-frame gaze suppression a real disable rather\n // than merely skipping the ray's intersection pass.\n if (entry.pointer.getEnabled()) {\n const buttonsDown = [...entry.pointer.getButtonsDown()];\n if (buttonsDown.length > 0) {\n // Mode switches terminate an in-flight far selection instead of\n // leaving a stale button/capture that could revive with ray fallback.\n if (!this.movedPointers.has(kind)) {\n // Flush an upstream down queued before the pointer's first move so\n // its matching cancel cannot be stranded in the same queue. In\n // normal updates move() has already run, avoiding callback\n // re-entry on this disable path.\n entry.pointer.commit(this.nativeEvent, false);\n this.movedPointers.add(kind);\n }\n entry.pointer.cancel(this.nativeEvent);\n }\n entry.pointer.setEnabled(false, this.nativeEvent, true);\n for (const button of buttonsDown) {\n entry.pointer.up({ button, timeStamp: this.nativeEvent.timeStamp });\n }\n }\n this.pointerStates.set(kind, InteractorState.DISABLED);\n // Clear active if this was the active pointer\n if (this.activeKind === kind) {\n this.activeKind = null;\n }\n }\n }\n\n /**\n * Compute intersections for all enabled pointers using type-specific descendant arrays.\n * Swaps scene.interactableDescendants per pointer type for optimized traversal.\n */\n private computeAllIntersections() {\n // Store original descendants once\n const originalDescendants =\n this.sceneWithDescendants.interactableDescendants;\n\n // Process each pointer with its type-specific descendants\n // Ray pointer\n if (this.pointerStates.get('ray') !== InteractorState.DISABLED) {\n this.sceneWithDescendants.interactableDescendants =\n this.sceneWithDescendants.rayDescendants;\n this.ray.pointer.move(this.scene, this.nativeEvent);\n this.markPointerMoved('ray', this.ray.pointer);\n }\n\n // Grab pointer\n if (this.pointerStates.get('grab') !== InteractorState.DISABLED) {\n this.sceneWithDescendants.interactableDescendants =\n this.sceneWithDescendants.grabDescendants;\n this.grab.pointer.move(this.scene, this.nativeEvent);\n this.markPointerMoved('grab', this.grab.pointer);\n }\n\n // Touch pointer\n if (this.pointerStates.get('touch') !== InteractorState.DISABLED) {\n this.sceneWithDescendants.interactableDescendants =\n this.touchCandidates();\n if (this.touchLiftPending) {\n this.touchLiftPending = this.isTouchTipDown();\n }\n if (!this.touchLiftPending) {\n this.touch.pointer.move(this.scene, this.nativeEvent);\n this.markPointerMoved('touch', this.touch.pointer);\n }\n }\n\n // Restore original descendants\n this.sceneWithDescendants.interactableDescendants = originalDescendants;\n }\n\n /**\n * Move a single pointer using its type-specific descendants.\n * Used when selection is locked to avoid unnecessary traversal.\n */\n private movePointerWithDescendants(kind: PointerKind, pointer: Pointer) {\n const originalDescendants =\n this.sceneWithDescendants.interactableDescendants;\n\n switch (kind) {\n case 'ray':\n this.sceneWithDescendants.interactableDescendants =\n this.sceneWithDescendants.rayDescendants;\n break;\n case 'grab':\n this.sceneWithDescendants.interactableDescendants =\n this.sceneWithDescendants.grabDescendants;\n break;\n case 'touch':\n this.sceneWithDescendants.interactableDescendants =\n this.touchCandidates();\n break;\n }\n\n pointer.move(this.scene, this.nativeEvent);\n this.markPointerMoved(kind, pointer);\n this.sceneWithDescendants.interactableDescendants = originalDescendants;\n }\n\n private markPointerMoved(kind: PointerKind, pointer: Pointer): void {\n if (pointer.intersector.isReady()) {\n this.movedPointers.add(kind);\n }\n }\n\n /**\n * Pick active pointer by priority - first with valid candidate wins\n */\n private pickActiveByPriority() {\n let newActiveKind: PointerKind | null = null;\n\n for (const kind of PRIORITY_ORDER) {\n const state = this.pointerStates.get(kind)!;\n if (state === InteractorState.DISABLED) {\n continue;\n }\n\n if (this.hasValidCandidate(kind)) {\n newActiveKind = kind;\n break;\n }\n }\n\n // Switch active pointer if changed\n if (newActiveKind !== this.activeKind) {\n this.switchActivePointer(newActiveKind);\n }\n }\n\n /**\n * Check if a pointer has a valid candidate (intersection)\n */\n private hasValidCandidate(kind: PointerKind): boolean {\n const entry = this.getEntry(kind);\n const intersection = entry.pointer.getIntersection();\n\n // No intersection or void object = no candidate\n if (!intersection || intersection.object.isVoidObject) {\n // For touch, update hysteresis state\n if (kind === 'touch') {\n this.touchHoverActive = false;\n }\n return false;\n }\n\n // For touch pointer, apply hysteresis\n if (kind === 'touch') {\n const threshold = this.touchHoverActive\n ? TOUCH_HYSTERESIS.exitHoverDistance\n : TOUCH_HYSTERESIS.enterHoverDistance;\n\n if (intersection.distance > threshold) {\n // Outside threshold\n if (!this.touchHoverActive) {\n return false;\n }\n // Was hovering but now outside exit threshold\n this.touchHoverActive = false;\n return false;\n }\n\n // Within threshold\n this.touchHoverActive = true;\n return true;\n }\n\n // For ray and grab, any valid intersection is a candidate\n return true;\n }\n\n /**\n * Touch outranks grab so a fingertip or controller tip can press a pokeable,\n * but only the active pointer's lifecycle runs and only the grab pointer\n * takes the squeeze. Without this, any pokeable within touch range (or the\n * grabbable itself, when it is also pokeable) swallows every squeeze. A\n * squeeze is a grab intent, so the grab pointer takes over whenever its\n * sphere has a target, even from a touch press, which it cancels. A ray\n * selection keeps its lock: its trigger release only reaches it while it is\n * the active pointer.\n */\n private preferGrabOnSqueeze() {\n if (\n this.pointerStates.get('ray') === InteractorState.SELECT ||\n this.pointerStates.get('grab') === InteractorState.SELECT ||\n !this.grabHasTarget()\n ) {\n return;\n }\n // The grab's selection lock stops moving the touch pointer until the\n // squeeze ends, so end its hover too, even when grab was already active\n // (the touch sphere reaches farther than the distance at which touch\n // becomes active). Otherwise a pokeable the tip passed stays `Hovered`\n // through the whole grab.\n this.releaseTouchForGrab(true);\n if (this.activeKind !== 'grab') {\n this.switchActivePointer('grab');\n }\n }\n\n /** Whether the grab sphere touches something a squeeze or pinch can grab. */\n private grabHasTarget(): boolean {\n return (\n this.pointerStates.get('grab') !== InteractorState.DISABLED &&\n this.hasValidCandidate('grab')\n );\n }\n\n /**\n * Ends what the touch pointer is doing when a grab takes the hand over.\n *\n * A press is cancelled. Left alone, it would hold the poked object pressed\n * (`Pressed`, UIKit active) through the grab, and lifting the tip after a\n * short grab would still click it. As when a browser cancels a touch, the\n * object gets pointercancel, then pointerout and pointerleave from `exit()`,\n * and no pointerup or click. The touch pointer then waits for the tip to\n * lift off (`touchLiftPending`) before it hovers or presses again.\n *\n * With `endHover`, a touch pointer that only hovers something gets the\n * leave events from `exit()` too, without the lift-off wait. A squeeze grab\n * passes it because its lock freezes the touch pointer. A routed pinch\n * doesn't: the touch pointer keeps moving through a pinch grab, so its\n * hover stays current.\n *\n * A touch pointer that touches nothing is left alone. Its button is down\n * then too: with no pokeable in reach, its hit is the scene's void object at\n * distance 0, which is within `downRadius`. Cancelling that press would send\n * pointercancel, pointerout and pointerleave to the void object, which\n * bubble to the scene, and start a lift-off wait for nothing.\n *\n * In pointer-events 6.6.32, `cancel()` clears the pressed button, its click\n * time and any capture. In 6.6.28 it only emits pointercancel and leaves\n * the button down, and `exit()` doesn't clear it either: `exit()` drops the\n * intersection and capture and commits. The touch pointer's move callback\n * (from `createTouchPointer`), which that commit runs, then sees no contact\n * and calls `up()`, which clears the button and emits nothing without an\n * intersection.\n */\n private releaseTouchForGrab(endHover: boolean) {\n if (this.pointerStates.get('touch') === InteractorState.DISABLED) {\n return;\n }\n const touch = this.touch.pointer;\n const intersection = touch.getIntersection();\n if (!intersection || intersection.object.isVoidObject) {\n return;\n }\n const pressing = touch.getButtonsDown().size > 0;\n if (pressing) {\n touch.cancel(this.nativeEvent);\n } else if (!endHover) {\n return;\n }\n touch.exit(this.nativeEvent);\n this.movedPointers.delete('touch');\n this.touchHoverActive = false;\n this.touchLiftPending = pressing;\n this.pointerStates.set('touch', InteractorState.NORMAL);\n }\n\n /**\n * Whether the touch tip is within press distance of a pokeable. Probes\n * without moving the touch pointer, so it emits no events.\n */\n private isTouchTipDown(): boolean {\n const intersection = this.touch.pointer.computeIntersection(\n 'pointer',\n this.scene,\n this.nativeEvent,\n );\n return (\n !intersection.object.isVoidObject &&\n intersection.distance <= TOUCH_DEFAULTS.downRadius\n );\n }\n\n /**\n * Switch active pointer to a new kind\n */\n private switchActivePointer(newKind: PointerKind | null) {\n // Disable previous active pointer (but keep it enabled in the pointer system)\n if (this.activeKind && this.activeKind !== newKind) {\n const prevState = this.pointerStates.get(this.activeKind)!;\n if (prevState === InteractorState.HOVER) {\n this.pointerStates.set(this.activeKind, InteractorState.NORMAL);\n }\n }\n\n this.activeKind = newKind;\n\n // Update new active pointer state\n if (newKind) {\n const state = this.pointerStates.get(newKind)!;\n if (state === InteractorState.NORMAL) {\n this.pointerStates.set(newKind, InteractorState.HOVER);\n }\n }\n }\n\n /**\n * Process lifecycle transitions based on input\n */\n private processLifecycle(input?: MultiPointerInput) {\n if (!this.activeKind) {\n return;\n }\n\n const entry = this.getEntry(this.activeKind);\n const state = this.pointerStates.get(this.activeKind)!;\n\n switch (this.activeKind) {\n case 'touch':\n // Touch auto-selects based on distance\n this.processTouchLifecycle(entry, state);\n break;\n\n case 'grab':\n // Grab uses squeeze button. A squeeze no longer held also ends the\n // grab: a source that stops reporting it (a hand that replaces the\n // controller mid-squeeze) never sends squeezeEnd.\n this.processButtonLifecycle(\n entry,\n state,\n !!input?.squeezeStart,\n !!input?.squeezeEnd || input?.squeezing === false,\n 2, // button 2 for squeeze\n );\n break;\n\n case 'ray':\n // Ray uses select button\n this.processButtonLifecycle(\n entry,\n state,\n !!input?.selectStart,\n !!input?.selectEnd,\n 0, // button 0 for select\n );\n break;\n }\n }\n\n /**\n * Process touch pointer lifecycle - auto-selects based on distance\n */\n private processTouchLifecycle(\n entry: PointerEntry<TouchPointer>,\n state: InteractorState,\n ) {\n const intersection = entry.pointer.getIntersection();\n if (!intersection || intersection.object.isVoidObject) {\n // Lost candidate - transition to NORMAL\n if (state === InteractorState.SELECT) {\n // Force release if touch was selecting when intersection was lost\n this.buttonEvent.timeStamp = this.nativeEvent.timeStamp;\n this.buttonEvent.button = 0;\n entry.pointer.up(this.buttonEvent);\n }\n if (state === InteractorState.HOVER || state === InteractorState.SELECT) {\n this.pointerStates.set('touch', InteractorState.NORMAL);\n }\n return;\n }\n\n // Touch auto-selection is handled by the pointer's onMoveCommited callback\n // (createTouchPointer sets this up). We just need to track the state.\n\n // Check if pointer is currently selecting (has buttons down)\n const isSelecting = entry.pointer.getButtonsDown().size > 0;\n\n if (state === InteractorState.HOVER && isSelecting) {\n this.pointerStates.set('touch', InteractorState.SELECT);\n } else if (state === InteractorState.SELECT && !isSelecting) {\n this.pointerStates.set('touch', InteractorState.HOVER);\n } else if (state === InteractorState.NORMAL) {\n this.pointerStates.set('touch', InteractorState.HOVER);\n }\n }\n\n /**\n * Process button-based pointer lifecycle (ray/grab)\n */\n private processButtonLifecycle(\n entry: PointerEntry<RayPointer | GrabPointer>,\n state: InteractorState,\n buttonDown: boolean,\n buttonUp: boolean,\n button: number,\n ) {\n const intersection = entry.pointer.getIntersection();\n if (!intersection || intersection.object.isVoidObject) {\n // Lost candidate - can happen during selection (pointer capture handles this)\n if (state === InteractorState.HOVER) {\n this.pointerStates.set(this.activeKind!, InteractorState.NORMAL);\n }\n // The selected object went away (e.g. the app disposed it) and the\n // button was released off any target. Release anyway, as the touch\n // lifecycle does, or the selection lock never ends.\n if (state === InteractorState.SELECT && buttonUp) {\n this.buttonEvent.timeStamp = this.nativeEvent.timeStamp;\n this.buttonEvent.button = button;\n entry.pointer.up(this.buttonEvent);\n this.pointerStates.set(this.activeKind!, InteractorState.NORMAL);\n }\n return;\n }\n\n // HOVER → SELECT on button down\n if (state === InteractorState.HOVER && buttonDown) {\n this.buttonEvent.timeStamp = this.nativeEvent.timeStamp;\n this.buttonEvent.button = button;\n entry.pointer.down(this.buttonEvent);\n this.pointerStates.set(this.activeKind!, InteractorState.SELECT);\n }\n // SELECT → HOVER on button up\n else if (state === InteractorState.SELECT && buttonUp) {\n this.buttonEvent.timeStamp = this.nativeEvent.timeStamp;\n this.buttonEvent.button = button;\n entry.pointer.up(this.buttonEvent);\n this.pointerStates.set(this.activeKind!, InteractorState.HOVER);\n }\n // NORMAL → HOVER when we have a candidate\n else if (state === InteractorState.NORMAL) {\n this.pointerStates.set(this.activeKind!, InteractorState.HOVER);\n }\n }\n\n /**\n * Get the policy for ray visual rendering\n */\n /** Objects this hand may poke: its own list when the scene has one. */\n private touchCandidates(): Object3D[] | undefined {\n return (\n this.sceneWithDescendants.touchDescendantsByHand?.[this.handedness] ??\n this.sceneWithDescendants.touchDescendants\n );\n }\n\n getPolicyForRay() {\n return { forceHideRay: this.shouldHideRay() };\n }\n\n private shouldHideRay(): boolean {\n // Hide the visual whenever the ray is disabled or a near pointer owns the\n // hand, including gaze-mode suppression.\n return (\n this.pointerStates.get('ray') === InteractorState.DISABLED ||\n (this.activeKind !== 'ray' && this.activeKind !== null)\n );\n }\n\n /**\n * Check if ray is busy (has intersection)\n */\n getRayBusy(): boolean {\n return !!this.ray.visual.busy;\n }\n\n /**\n * Toggle a sub-pointer on/off\n */\n toggleSubPointer(kind: PointerKind, enabled: boolean): boolean {\n const entry = this.getEntry(kind);\n if (entry.registered === enabled) {\n return false;\n }\n entry.registered = enabled;\n if (!enabled) {\n this.pointerStates.set(kind, InteractorState.DISABLED);\n if (this.activeKind === kind) {\n this.activeKind = null;\n }\n if (kind === 'touch') {\n this.touchHoverActive = false;\n }\n }\n return true;\n }\n\n /**\n * Get the registration state of a sub-pointer\n */\n getSubPointerState(kind: PointerKind): { registered: boolean } {\n const entry = this.getEntry(kind);\n return { registered: entry.registered };\n }\n\n /**\n * Get the currently active pointer kind\n */\n getActiveKind(): PointerKind | null {\n return this.activeKind;\n }\n\n /**\n * Computes a world-space offset that keeps the hand visual's fingertip on the\n * touched surface while the touch pointer is actively selecting.\n */\n getTouchSurfaceVisualOffset(target: Vector3 = new Vector3()): Vector3 | null {\n if (this.activeKind !== 'touch') {\n return null;\n }\n\n if (this.pointerStates.get('touch') !== InteractorState.SELECT) {\n return null;\n }\n\n const intersection = this.touch.pointer.getIntersection();\n if (\n !intersection ||\n intersection.object.isVoidObject ||\n intersection.details.type !== 'sphere'\n ) {\n return null;\n }\n\n target.copy(intersection.pointOnFace).sub(intersection.pointerPosition);\n if (target.lengthSq() < TOUCH_VISUAL_OFFSET_EPSILON_SQ) {\n return null;\n }\n\n return target;\n }\n\n /**\n * Get the currently active pointer\n */\n getActivePointer(): Pointer | null {\n if (!this.activeKind) {\n return null;\n }\n return this.getEntry(this.activeKind).pointer;\n }\n\n /**\n * Get a specific pointer by kind\n */\n getPointer(kind: PointerKind): Pointer {\n return this.getEntry(kind).pointer;\n }\n\n /**\n * Route a down event to a specific pointer target.\n * Used by grab-system for hand pinch gestures.\n */\n routeDown(\n kind: 'select' | 'squeeze' | 'custom',\n target: 'ray' | 'grab' | 'active',\n nativeEvent: { timeStamp: number },\n ) {\n const ptr = this.pickTarget(target);\n if (!ptr) {\n return;\n }\n // A down routed to the grab pointer (a hand pinch) grabs what the grab\n // sphere touches, so it cancels a fingertip press the way a squeeze does.\n // The pinch doesn't take the selection lock, so the touch pointer keeps\n // moving and a mere hover stays.\n if (target === 'grab' && this.grabHasTarget()) {\n this.releaseTouchForGrab(false);\n }\n const button = kind === 'select' ? 0 : 2;\n ptr.down({ button, timeStamp: nativeEvent.timeStamp });\n }\n\n /**\n * Route an up event to a specific pointer target.\n * Used by grab-system for hand pinch gestures.\n */\n routeUp(\n kind: 'select' | 'squeeze' | 'custom',\n target: 'ray' | 'grab' | 'active',\n nativeEvent: { timeStamp: number },\n ) {\n const ptr = this.pickTarget(target);\n if (!ptr) {\n return;\n }\n const button = kind === 'select' ? 0 : 2;\n ptr.up({ button, timeStamp: nativeEvent.timeStamp });\n }\n\n /**\n * Pick pointer by target type.\n */\n private pickTarget(target: 'ray' | 'grab' | 'active'): Pointer | undefined {\n if (target === 'active') {\n // Prefer captured pointer if any, else fall back to active or ray\n if (this.ray.pointer.getPointerCapture?.()) {\n return this.ray.pointer;\n }\n if (this.grab.pointer.getPointerCapture?.()) {\n return this.grab.pointer;\n }\n if (this.touch.pointer.getPointerCapture?.()) {\n return this.touch.pointer;\n }\n // Fall back to active pointer or ray\n return this.activeKind\n ? this.getEntry(this.activeKind).pointer\n : this.ray.pointer;\n }\n if (target === 'ray') {\n return this.ray.pointer;\n }\n return this.grab.pointer;\n }\n\n /**\n * Get the entry for a pointer kind\n */\n private getEntry(\n kind: PointerKind,\n ): PointerEntry<RayPointer | GrabPointer | TouchPointer> {\n switch (kind) {\n case 'ray':\n return this.ray;\n case 'grab':\n return this.grab;\n case 'touch':\n return this.touch;\n }\n }\n\n /**\n * Dispose of all pointer resources.\n * Call this when the MultiPointer is no longer needed.\n */\n dispose(): void {\n // Dispose cursor visual\n this.cursorVisual.dispose();\n\n // Dispose ray pointer (has geometry/material)\n this.ray.visual.dispose();\n\n // Clear state\n this.pointerStates.clear();\n this.activeKind = null;\n }\n}\n"],"names":[],"mappings":";;;;;;AAAA;;;;;AAKG;AAgCH;;AAEG;IACS;AAAZ,CAAA,UAAY,eAAe,EAAA;;AAEzB,IAAA,eAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;;AAErB,IAAA,eAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;;AAEjB,IAAA,eAAA,CAAA,OAAA,CAAA,GAAA,OAAe;;AAEf,IAAA,eAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACnB,CAAC,EATW,eAAe,KAAf,eAAe,GAAA,EAAA,CAAA,CAAA;AAW3B;;AAEG;AACH,MAAM,cAAc,GAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC;AAE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;;"}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "1.2.0-rc.
|
|
1
|
+
export declare const VERSION = "1.2.0-rc.2";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xr-input-manager.d.ts","sourceRoot":"","sources":["../src/xr-input-manager.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAU,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAEL,QAAQ,EACR,iBAAiB,EACjB,KAAK,EAEL,YAAY,EACb,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAE5E,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAoB,MAAM,2BAA2B,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAAE,yBAAyB,EAAE,MAAM,+CAA+C,CAAC;AAC1F,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAG9E,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACrB,MAAM,4BAA4B,CAAC;AAcpC,UAAU,eAAe;IACvB,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,OAAO,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;CACjB;AAGD,oBAAY,iBAAiB;IAC3B,UAAU,eAAe;IACzB,IAAI,SAAS;CACd;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5C;AAED,eAAO,MAAM,oBAAoB;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,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO;IAIzE;;;OAGG;IACH,qBAAqB,CACnB,UAAU,EAAE,MAAM,GAAG,OAAO,GAC3B,aAAa,GAAG,SAAS;IAI5B;;;;;OAKG;IACH,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC,eAAe,CAAC;IAIvE,OAAO,CAAC,uBAAuB;IAW/B,OAAO,CAAC,sBAAsB;IAwB9B,OAAO,CAAC,qBAAqB;IAgC7B,OAAO,CAAC,qBAAqB;IAW7B,OAAO,CAAC,yBAAyB;IASjC,OAAO,CAAC,4BAA4B;IAKpC;;;;OAIG;IACH,OAAO,CAAC,0BAA0B;IAUlC,OAAO,CAAC,mBAAmB;IAsC3B;;;;;;;;;;;;;;;;OAgBG;IACH,OAAO,CAAC,wBAAwB;IAsBhC,OAAO,CAAC,iBAAiB;IAgBzB,OAAO,CAAC,yBAAyB;IA4GjC,OAAO,CAAC,cAAc;IAqDtB;;;;;;;OAOG;IACH,OAAO,CAAC,iBAAiB;CA8B1B"}
|
package/dist/xr-input-manager.js
CHANGED
|
@@ -557,11 +557,17 @@ class XRInputManager {
|
|
|
557
557
|
const squeezeEnd = connected
|
|
558
558
|
? !!(gp === null || gp === void 0 ? void 0 : gp.getButtonUp('xr-standard-squeeze'))
|
|
559
559
|
: false;
|
|
560
|
+
// The held state too, not just the edges: a hand that replaces the
|
|
561
|
+
// controller mid-squeeze reports no squeeze at all (no Gamepad, or a
|
|
562
|
+
// pinch-only one), so no squeezeEnd ever comes and the grab would keep
|
|
563
|
+
// that hand locked on it.
|
|
564
|
+
const squeezing = connected && !!(gp === null || gp === void 0 ? void 0 : gp.getButtonPressed('xr-standard-squeeze'));
|
|
560
565
|
this.multiPointers[handedness].update(connected, delta, time, {
|
|
561
566
|
selectStart,
|
|
562
567
|
selectEnd,
|
|
563
568
|
squeezeStart,
|
|
564
569
|
squeezeEnd,
|
|
570
|
+
squeezing,
|
|
565
571
|
suppressRay: suppressFarRay,
|
|
566
572
|
});
|
|
567
573
|
const touchSurfaceVisualOffset = this.multiPointers[handedness].getTouchSurfaceVisualOffset(this.touchSurfaceVisualOffsets[handedness]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xr-input-manager.js","sources":["../src/xr-input-manager.ts"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { Signal, signal } from '@preact/signals-core';\nimport {\n Group,\n Object3D,\n PerspectiveCamera,\n Scene,\n Vector3,\n WebXRManager,\n} from 'three';\nimport { GLTF, GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';\nimport { loadInputProfile } from './gamepad/input-profiles.js';\nimport { StatefulGamepad } from './gamepad/stateful-gamepad.js';\nimport { GazePointer, GazePointerInput } from './pointer/gaze-pointer.js';\nimport { MultiPointer } from './pointer/multi-pointer.js';\nimport { XROrigin } from './rig/xr-origin.js';\nimport { XRInputVisualAdapter } from './visual/adapter/base-visual-adapter.js';\nimport { XRControllerVisualAdapter } from './visual/adapter/controller-visual-adapter.js';\nimport { XRHandVisualAdapter } from './visual/adapter/hand-visual-adapter.js';\nimport { AnimatedController } from './visual/impl/animated-controller.js';\nimport { AnimatedHand } from './visual/impl/animated-hand.js';\nimport {\n VisualConstructor,\n VisualImplementation,\n} from './visual/impl/base-impl.js';\n\ninterface InputSourceData {\n inputSource: XRInputSource;\n isPrimary: boolean;\n}\n\ninterface HandSelectEventState {\n inputSource: XRInputSource | undefined;\n actualActive: boolean;\n reportedActive: boolean;\n transitions: Array<'start' | 'end'>;\n}\n\ninterface HandSelectState {\n start: boolean;\n end: boolean;\n active: boolean;\n}\n\nconst MAX_HAND_SELECT_TRANSITIONS = 4;\nexport enum XRInputDeviceType {\n Controller = 'controller',\n Hand = 'hand',\n}\n\nexport interface XRAssetLoader {\n loadGLTF(assetPath: string): Promise<GLTF>;\n}\n\nexport const DefaultXRAssetLoader = {\n gltfLoader: new GLTFLoader(),\n async loadGLTF(assetPath: string): Promise<GLTF> {\n return await DefaultXRAssetLoader.gltfLoader.loadAsync(assetPath);\n },\n};\n\nexport interface XRInputDeviceConfig {\n handedness: XRHandedness;\n type: XRInputDeviceType;\n enabled?: boolean;\n visualClass?: VisualConstructor<VisualImplementation>;\n}\n\nexport interface XRPointerSettings {\n enabled?: boolean;\n}\n\nexport interface XRInputOptions {\n camera: PerspectiveCamera;\n scene: Scene;\n assetLoader?: XRAssetLoader;\n inputDevices?: XRInputDeviceConfig[];\n pointerSettings?: XRPointerSettings;\n}\n\nexport class XRInputManager {\n public readonly xrOrigin: XROrigin;\n\n public readonly multiPointers: Record<'left' | 'right', MultiPointer>;\n\n /**\n * Single global gaze pointer — gaze has no handedness, so it sits beside\n * {@link XRInputManager.multiPointers} rather than inside them.\n *\n * Constructed unconditionally so systems (`GrabSystem`, `GazeSystem`) can\n * hold a stable reference, but idle until {@link XRInputManager.gazeEnabled}\n * is set. Nothing here costs a frame while gaze is off.\n */\n public readonly gazePointer: GazePointer;\n\n /**\n * Master switch for the gaze pipeline, flipped on by `GazeSystem` when the\n * project opts into the gaze XR feature. While `false`, the gaze pose is\n * never sampled, no cone cast runs, no pointer events are dispatched, and\n * the pointer's reticle and ray space stay out of the rig entirely.\n */\n public get gazeEnabled(): boolean {\n return this.gazeEnabledFlag;\n }\n\n public set gazeEnabled(enabled: boolean) {\n if (enabled === this.gazeEnabledFlag) {\n return;\n }\n this.gazeEnabledFlag = enabled;\n this.resetGazeHandSelectionArming();\n if (!enabled) {\n this.gazePointer.reset();\n this.xrOrigin.clearGaze();\n }\n this.gazePointer.setAttached(enabled);\n }\n\n private gazeEnabledFlag = false;\n\n /**\n * Gaze-eligible Object3D roots, republished by the host every frame before\n * {@link XRInputManager.update}. Gaze deliberately uses an explicit\n * candidate list rather than raycasting the scene: the cone cast is\n * O(candidates), and gaze should only consider objects that opted in.\n */\n public gazeCandidates: ReadonlyArray<Object3D> = [];\n\n private readonly gazeInput: GazePointerInput = {\n candidates: [],\n pinchStart: { left: false, right: false },\n pinchEnd: { left: false, right: false },\n pinchActive: { left: false, right: false },\n directPointerActive: { left: false, right: false },\n };\n\n public readonly gamepads = {\n left: undefined,\n right: undefined,\n } as Record<'left' | 'right', StatefulGamepad | undefined>;\n\n public readonly visualAdapters: {\n controller: {\n left: XRControllerVisualAdapter;\n right: XRControllerVisualAdapter;\n };\n hand: {\n left: XRHandVisualAdapter;\n right: XRHandVisualAdapter;\n };\n left: Signal<XRInputVisualAdapter | undefined>;\n right: Signal<XRInputVisualAdapter | undefined>;\n };\n\n private activeInputSources = {\n hand: { left: undefined, right: undefined },\n controller: { left: undefined, right: undefined },\n } as Record<\n 'hand' | 'controller',\n Record<'left' | 'right', InputSourceData | undefined>\n >;\n\n private primaryInputSources = {\n left: undefined,\n right: undefined,\n } as Record<'left' | 'right', XRInputSource | undefined>;\n\n /**\n * Sides whose primary source has no pose this frame: a hand whose wrist is\n * not tracked, or a controller without a target ray pose. Their pointers\n * stay disconnected (no raycasts) and their visuals hidden until tracking\n * returns. Cleared every frame with the active sources.\n */\n private readonly untrackedPrimary = { left: false, right: false };\n\n private scene: Scene;\n private hadSession = false;\n private readonly touchSurfaceVisualOffsets = {\n left: new Vector3(),\n right: new Vector3(),\n };\n\n private processedInputSourceKeys = new Set<string>();\n\n private selectEventSession: XRSession | undefined;\n private readonly handSelectEvents: Record<\n 'left' | 'right',\n HandSelectEventState\n > = {\n left: {\n inputSource: undefined,\n actualActive: false,\n reportedActive: false,\n transitions: [],\n },\n right: {\n inputSource: undefined,\n actualActive: false,\n reportedActive: false,\n transitions: [],\n },\n };\n private readonly handSelectFrameState: Record<\n 'left' | 'right',\n HandSelectState\n > = {\n left: { start: false, end: false, active: false },\n right: { start: false, end: false, active: false },\n };\n private readonly gazeHandSelectionArmed = {\n left: false,\n right: false,\n };\n private readonly pointerDisableWarnings = new Set<\n 'left' | 'right' | 'gaze'\n >();\n private readonly selectStartHandler = (event: XRInputSourceEvent) => {\n this.updateHandSelectEvent(event, true);\n };\n private readonly selectEndHandler = (event: XRInputSourceEvent) => {\n this.updateHandSelectEvent(event, false);\n };\n\n constructor(options: XRInputOptions) {\n const { scene, camera, assetLoader } = options;\n this.xrOrigin = new XROrigin();\n this.scene = scene; // used implicitly by MultiPointer via constructor\n this.visualAdapters = {\n controller: {\n left: new XRControllerVisualAdapter(\n this.xrOrigin,\n 'left',\n true, // visuals enabled\n AnimatedController,\n scene,\n camera,\n assetLoader || DefaultXRAssetLoader,\n ),\n right: new XRControllerVisualAdapter(\n this.xrOrigin,\n 'right',\n true, // visuals enabled\n AnimatedController,\n scene,\n camera,\n assetLoader || DefaultXRAssetLoader,\n ),\n },\n hand: {\n left: new XRHandVisualAdapter(\n this.xrOrigin,\n 'left',\n true, // visuals enabled\n AnimatedHand,\n scene,\n camera,\n assetLoader || DefaultXRAssetLoader,\n ),\n right: new XRHandVisualAdapter(\n this.xrOrigin,\n 'right',\n true, // visuals enabled\n AnimatedHand,\n scene,\n camera,\n assetLoader || DefaultXRAssetLoader,\n ),\n },\n left: signal(undefined),\n right: signal(undefined),\n };\n\n this.multiPointers = {\n left: new MultiPointer('left', this.scene, camera, this.xrOrigin),\n right: new MultiPointer('right', this.scene, camera, this.xrOrigin),\n };\n\n this.gazePointer = new GazePointer(this.xrOrigin, this.scene, camera);\n }\n\n update(xrManager: WebXRManager, delta: number, time: number): void {\n const session = xrManager.getSession();\n if (!session) {\n this.syncSelectEventSession(undefined);\n if (this.hadSession) {\n this.onSessionEnded();\n } else {\n this.disablePointers(time);\n }\n this.hadSession = false;\n return;\n }\n this.hadSession = true;\n this.syncSelectEventSession(session);\n\n const refSpace = xrManager.getReferenceSpace();\n const frame = xrManager.getFrame();\n if (!refSpace || !frame) {\n this.disablePointers(time);\n return;\n }\n\n // Reset active input sources\n this.resetActiveInputSources();\n\n // Update active input sources\n this.updateActiveInputSources(session);\n\n // Update controllers and hands (poses + visuals + gamepads)\n this.updateControllersAndHands(frame, refSpace, delta);\n this.updateHandSelectFrameState();\n\n // Update head tracking\n this.xrOrigin.updateHead(frame, refSpace);\n\n // Probe the real gaze target ray while frame/refSpace are in hand, and\n // before the matrix flush below, so eyeSpace's world matrix is current by\n // the time the pointer reads it.\n if (this.gazeEnabled) {\n this.gazePointer.sampleGazePose(time, {\n frame,\n referenceSpace: refSpace,\n session,\n });\n }\n\n // Force matrix update for xrOrigin, and then update pointers\n this.xrOrigin.updateMatrixWorld(true);\n this.updatePointers(delta, time);\n\n // Gaze runs after the hand pointers so it can read their active state for\n // suppression — direct manipulation always wins over gaze.\n this.updateGazePointer(delta, time);\n }\n\n private onSessionEnded(): void {\n // Clear active sources and visuals\n this.resetActiveInputSources();\n\n // Disconnect controller/hand visuals and clear primary adapters\n (['left', 'right'] as const).forEach((handedness) => {\n const ctrl = this.visualAdapters.controller[handedness];\n const hand = this.visualAdapters.hand[handedness];\n if (ctrl.connected) {\n ctrl.disconnect();\n }\n if (hand.connected) {\n hand.disconnect();\n }\n });\n this.visualAdapters.left.value = undefined;\n this.visualAdapters.right.value = undefined;\n\n // Gaze has no per-frame source outside a session; drop it back to 'none'\n // so consumers don't read a stale tracked origin.\n this.xrOrigin.clearGaze();\n\n // Full reset (not just disable) so the next session re-runs the gaze\n // diagnostics from scratch instead of reporting the previous one's verdict.\n this.gazePointer.reset();\n\n // Hide pointer visuals and disable combined pointers\n this.disablePointers();\n }\n\n private disablePointers(time = 0): void {\n this.resetHandSelectEvents();\n this.resetHandSelectFrameState();\n this.resetGazeHandSelectionArming();\n for (const handedness of ['left', 'right'] as const) {\n try {\n this.multiPointers[handedness].update(false, 0, time);\n this.pointerDisableWarnings.delete(handedness);\n } catch (error) {\n this.warnPointerDisableFailure(handedness, error);\n }\n }\n try {\n this.gazeInput.candidates = [];\n for (const handedness of ['left', 'right'] as const) {\n this.gazeInput.pinchStart[handedness] = false;\n this.gazeInput.pinchEnd[handedness] = false;\n this.gazeInput.pinchActive[handedness] = false;\n this.gazeInput.directPointerActive[handedness] = false;\n }\n this.gazePointer.update(false, 0, time, this.gazeInput);\n this.pointerDisableWarnings.delete('gaze');\n } catch (error) {\n this.warnPointerDisableFailure('gaze', error);\n }\n }\n\n private warnPointerDisableFailure(\n pointer: 'left' | 'right' | 'gaze',\n error: unknown,\n ): void {\n if (!this.pointerDisableWarnings.has(pointer)) {\n this.pointerDisableWarnings.add(pointer);\n console.warn(`[IWSDK] Failed to disable ${pointer} pointer:`, error);\n }\n }\n\n isPrimary(deviceType: 'controller' | 'hand', handedness: 'left' | 'right') {\n return !!this.activeInputSources[deviceType][handedness]?.isPrimary;\n }\n\n /**\n * Get the primary input source for a given handedness.\n * Returns the XRInputSource that is currently active for left or right hand.\n */\n getPrimaryInputSource(\n handedness: 'left' | 'right',\n ): XRInputSource | undefined {\n return this.primaryInputSources[handedness];\n }\n\n /**\n * Get this frame's select state for the primary input source of a given\n * handedness, as the hand and gaze pointers see it. Unlike\n * `gamepads[handedness]`, this also covers hand sources that expose no\n * Gamepad, whose pinch edges come from the session's select events.\n */\n getSelectState(handedness: 'left' | 'right'): Readonly<HandSelectState> {\n return this.handSelectFrameState[handedness];\n }\n\n private resetActiveInputSources(): void {\n this.activeInputSources.controller.left = undefined;\n this.activeInputSources.controller.right = undefined;\n this.activeInputSources.hand.left = undefined;\n this.activeInputSources.hand.right = undefined;\n this.primaryInputSources.left = undefined;\n this.primaryInputSources.right = undefined;\n this.untrackedPrimary.left = false;\n this.untrackedPrimary.right = false;\n }\n\n private syncSelectEventSession(session: XRSession | undefined): void {\n if (this.selectEventSession === session) {\n return;\n }\n if (this.selectEventSession) {\n this.selectEventSession.removeEventListener(\n 'selectstart',\n this.selectStartHandler,\n );\n this.selectEventSession.removeEventListener(\n 'selectend',\n this.selectEndHandler,\n );\n }\n this.resetHandSelectEvents();\n this.resetHandSelectFrameState();\n this.resetGazeHandSelectionArming();\n this.selectEventSession = session;\n if (session) {\n session.addEventListener('selectstart', this.selectStartHandler);\n session.addEventListener('selectend', this.selectEndHandler);\n }\n }\n\n private updateHandSelectEvent(\n event: XRInputSourceEvent,\n active: boolean,\n ): void {\n const inputSource = event.inputSource;\n const handedness = inputSource.handedness;\n if (\n !inputSource.hand ||\n (handedness !== 'left' && handedness !== 'right')\n ) {\n return;\n }\n const state = this.handSelectEvents[handedness];\n if (state.inputSource !== inputSource) {\n state.inputSource = inputSource;\n state.actualActive = false;\n state.reportedActive = false;\n state.transitions.length = 0;\n }\n if (state.actualActive === active) {\n return;\n }\n state.actualActive = active;\n // Keep the newest complete gesture cycles if a suspended renderer lets\n // events outrun frames. Removing two alternating edges preserves both the\n // current reported state and the final physical state.\n if (state.transitions.length >= MAX_HAND_SELECT_TRANSITIONS) {\n state.transitions.splice(0, 2);\n }\n state.transitions.push(active ? 'start' : 'end');\n }\n\n private resetHandSelectEvents(handedness?: 'left' | 'right'): void {\n const hands = handedness ? [handedness] : (['left', 'right'] as const);\n for (const hand of hands) {\n const state = this.handSelectEvents[hand];\n state.inputSource = undefined;\n state.actualActive = false;\n state.reportedActive = false;\n state.transitions.length = 0;\n }\n }\n\n private resetHandSelectFrameState(): void {\n for (const handedness of ['left', 'right'] as const) {\n const state = this.handSelectFrameState[handedness];\n state.start = false;\n state.end = false;\n state.active = false;\n }\n }\n\n private resetGazeHandSelectionArming(): void {\n this.gazeHandSelectionArmed.left = false;\n this.gazeHandSelectionArmed.right = false;\n }\n\n /**\n * Snapshot each hand's selection once per render frame. Native hand sources\n * expose WebXR select events but no Gamepad, and both the hand pointer and\n * gaze pointer must observe the same edge without consuming it twice.\n */\n private updateHandSelectFrameState(): void {\n for (const handedness of ['left', 'right'] as const) {\n const next = this.readHandSelectState(handedness);\n const state = this.handSelectFrameState[handedness];\n state.start = next.start;\n state.end = next.end;\n state.active = next.active;\n }\n }\n\n private readHandSelectState(handedness: 'left' | 'right'): HandSelectState {\n const gamepad = this.gamepads[handedness];\n if (gamepad) {\n this.resetHandSelectEvents(handedness);\n return {\n start: gamepad.getSelectStart(),\n end: gamepad.getSelectEnd(),\n active: gamepad.getSelecting(),\n };\n }\n\n const inputSource = this.primaryInputSources[handedness];\n const state = this.handSelectEvents[handedness];\n const matches = Boolean(\n inputSource?.hand && state.inputSource === inputSource,\n );\n if (!matches) {\n this.resetHandSelectEvents(handedness);\n return { start: false, end: false, active: false };\n }\n\n // Deliver at most one edge per render frame. A short native pinch can\n // produce selectstart and selectend between two app frames; preserving\n // their order guarantees a down frame followed by an up/click frame.\n const transition = state.transitions.shift();\n if (transition === 'start') {\n state.reportedActive = true;\n } else if (transition === 'end') {\n state.reportedActive = false;\n }\n const result = {\n start: transition === 'start',\n end: transition === 'end',\n active: state.reportedActive,\n };\n return result;\n }\n\n /**\n * Updates the active input sources from the XR session.\n *\n * IMPORTANT: This method handles a platform quirk where some runtimes\n * include the same hands in BOTH session.inputSources AND session.trackedSources.\n * The duplicate entries represent the same physical hands but as different XRInputSource objects\n * with different properties (e.g., different gamepad.buttons lengths).\n *\n * To prevent the trackedSources from overwriting the isPrimary status set by inputSources,\n * we track which handedness+type combinations have already been processed and skip\n * re-processing duplicates from trackedSources.\n *\n * Without this deduplication:\n * - Hands from inputSources would be marked as isPrimary=true\n * - Then the same hands from trackedSources would overwrite with isPrimary=false\n * - This causes hand visuals to not be displayed (since visibility is tied to isPrimary)\n */\n private updateActiveInputSources(session: XRSession): void {\n this.processedInputSourceKeys.clear();\n\n // Process inputSources (these are primary)\n for (const inputSource of session.inputSources) {\n this.assignInputSource(inputSource, true);\n const key = `${inputSource.handedness}-${inputSource.hand ? 'hand' : 'controller'}`;\n this.processedInputSourceKeys.add(key);\n }\n\n // Process trackedSources (these are non-primary)\n // Skip any that were already in inputSources to avoid overwriting isPrimary\n if (session.trackedSources) {\n for (const inputSource of session.trackedSources) {\n const key = `${inputSource.handedness}-${inputSource.hand ? 'hand' : 'controller'}`;\n if (!this.processedInputSourceKeys.has(key)) {\n this.assignInputSource(inputSource, false);\n }\n }\n }\n }\n\n private assignInputSource(\n inputSource: XRInputSource,\n isPrimary: boolean,\n ): void {\n const handedness = inputSource.handedness;\n if (handedness === 'left' || handedness === 'right') {\n const target = inputSource.hand\n ? this.activeInputSources.hand\n : this.activeInputSources.controller;\n target[handedness] = { inputSource, isPrimary };\n if (isPrimary) {\n this.primaryInputSources[handedness] = inputSource;\n }\n }\n }\n\n private updateControllersAndHands(\n frame: XRFrame,\n refSpace: XRReferenceSpace,\n delta: number,\n ): void {\n (['left', 'right'] as const).forEach((handedness) => {\n (['controller', 'hand'] as const).forEach((key) => {\n const inputSourceData = this.activeInputSources[key][handedness];\n const visualAdapter = this.visualAdapters[key][handedness];\n if (inputSourceData) {\n const { inputSource, isPrimary } = inputSourceData;\n const raySpace = isPrimary\n ? this.xrOrigin.raySpaces[handedness]\n : this.xrOrigin.secondaryRaySpaces[handedness];\n const gripSpace = isPrimary\n ? this.xrOrigin.gripSpaces[handedness]\n : this.xrOrigin.secondaryGripSpaces[handedness];\n visualAdapter.raySpace = raySpace;\n visualAdapter.gripSpace = gripSpace;\n const rayTracked = updatePose(\n frame,\n inputSource.targetRaySpace,\n refSpace,\n raySpace,\n );\n // WebXR Hand Input: a hand whose wrist has no pose is not tracked,\n // whatever its target ray says. A runtime can keep listing a hand,\n // with an aim pose, while it sees no hand at all.\n const tracked = inputSource.hand\n ? hasWristPose(frame, inputSource.hand, refSpace)\n : rayTracked;\n if (isPrimary && !tracked) {\n this.untrackedPrimary[handedness] = true;\n }\n if (inputSource.gripSpace) {\n updatePose(frame, inputSource.gripSpace, refSpace, gripSpace);\n } else {\n gripSpace.position.copy(raySpace.position);\n gripSpace.quaternion.copy(raySpace.quaternion);\n gripSpace.scale.copy(raySpace.scale);\n }\n\n if (visualAdapter.inputSource !== inputSourceData.inputSource) {\n visualAdapter.connect(inputSourceData.inputSource);\n }\n if (tracked) {\n visualAdapter.update(frame, delta);\n }\n visualAdapter.isPrimary = inputSourceData.isPrimary;\n if (visualAdapter.isPrimary) {\n this.visualAdapters[handedness].value = visualAdapter;\n }\n if (visualAdapter.visual) {\n visualAdapter.visual.model.visible =\n inputSourceData.isPrimary && tracked;\n }\n\n // Update index tip space for hands (used by TouchPointer)\n if (key === 'hand' && isPrimary && tracked) {\n const handAdapter = this.visualAdapters.hand[handedness];\n const indexTipXRSpace = handAdapter.getIndexTipSpace();\n if (indexTipXRSpace) {\n updatePose(\n frame,\n indexTipXRSpace,\n refSpace,\n this.xrOrigin.indexTipSpaces[handedness],\n );\n }\n }\n } else if (visualAdapter.connected) {\n visualAdapter.disconnect();\n }\n });\n\n // For controllers, fallback indexTipSpace to raySpace (no finger tracking)\n const hasHandActive = !!this.activeInputSources.hand[handedness];\n if (!hasHandActive && this.activeInputSources.controller[handedness]) {\n const raySpace = this.xrOrigin.raySpaces[handedness];\n const indexTipSpace = this.xrOrigin.indexTipSpaces[handedness];\n indexTipSpace.position.copy(raySpace.position);\n indexTipSpace.quaternion.copy(raySpace.quaternion);\n indexTipSpace.scale.copy(raySpace.scale);\n }\n });\n (['left', 'right'] as const).forEach((handedness) => {\n const inputSource = this.primaryInputSources[handedness];\n\n // If the input source changed, clear the cached StatefulGamepad.\n if (this.gamepads[handedness]?.inputSource !== inputSource) {\n this.gamepads[handedness] = undefined;\n }\n\n const hasGamepad = !!(inputSource && inputSource.gamepad);\n\n // Lazily create a StatefulGamepad only when a gamepad is available.\n if (!this.gamepads[handedness] && hasGamepad) {\n const inputConfig = loadInputProfile(inputSource!);\n this.gamepads[handedness] = new StatefulGamepad(inputConfig);\n }\n\n // Update if present and source still has a gamepad.\n if (hasGamepad) {\n this.gamepads[handedness]?.update();\n }\n });\n }\n\n private updatePointers(delta: number, time: number) {\n // Gaze and hand/controller rays are alternative far-targeting modes in\n // ISDK. Once gaze mode has acquired a valid source, disable far rays rather than\n // letting their incidental hits compete with gaze. An invalid frame clears\n // gaze hover but does not flash the ray mode; near touch/grab stays enabled.\n const suppressFarRay =\n this.gazeEnabled && this.gazePointer.ownsFarTargeting(time);\n (['left', 'right'] as const).forEach((handedness) => {\n const inputSource = this.primaryInputSources[handedness];\n const gp = this.gamepads[handedness];\n // WebXR Hand Input requires hand sources to expose no Gamepad. Their\n // select edges come from the session-level event snapshot above. A\n // source without a pose this frame has nothing to aim with: its pointers\n // stay disconnected, so no ray, grab or touch pointer raycasts the scene.\n const connected =\n !!(inputSource && (gp || inputSource.hand)) &&\n !this.untrackedPrimary[handedness];\n const select = this.handSelectFrameState[handedness];\n const selectStart = connected ? select.start : false;\n const selectEnd = connected ? select.end : false;\n\n // First: move all registered pointers (ray + grab) via the combined pointer\n const squeezeStart = connected\n ? !!gp?.getButtonDown('xr-standard-squeeze')\n : false;\n const squeezeEnd = connected\n ? !!gp?.getButtonUp('xr-standard-squeeze')\n : false;\n this.multiPointers[handedness].update(connected, delta, time, {\n selectStart,\n selectEnd,\n squeezeStart,\n squeezeEnd,\n suppressRay: suppressFarRay,\n });\n\n const touchSurfaceVisualOffset = this.multiPointers[\n handedness\n ].getTouchSurfaceVisualOffset(this.touchSurfaceVisualOffsets[handedness]);\n const handAdapter = this.visualAdapters.hand[handedness];\n if (touchSurfaceVisualOffset && handAdapter.isPrimary) {\n handAdapter.applyVisualOffsetWorld(touchSurfaceVisualOffset);\n }\n });\n }\n\n /**\n * Drive the global gaze pointer from this frame's candidates and pinch state.\n *\n * Either hand's pinch can commit a gaze selection, so both are sampled and\n * the pointer applies its own hand mutual-exclusion. Direct touch/grab state\n * feeds the pointer's suppression rule; it's read after\n * {@link XRInputManager.updatePointers} so it reflects this frame, not last.\n */\n private updateGazePointer(delta: number, time: number): void {\n if (!this.gazeEnabled) {\n return;\n }\n const input = this.gazeInput;\n input.candidates = this.gazeCandidates;\n (['left', 'right'] as const).forEach((handedness) => {\n const select = this.handSelectFrameState[handedness];\n if (!this.gazeHandSelectionArmed[handedness]) {\n // Enabling gaze while a pinch is held or queued must not turn input\n // that occurred while gaze was off into a synthetic gaze click. Arm\n // only after the event bridge reaches a fully released baseline.\n const events = this.handSelectEvents[handedness];\n if (!select.active && events.transitions.length === 0) {\n this.gazeHandSelectionArmed[handedness] = true;\n }\n input.pinchStart[handedness] = false;\n input.pinchEnd[handedness] = false;\n input.pinchActive[handedness] = false;\n } else {\n input.pinchStart[handedness] = select.start;\n input.pinchEnd[handedness] = select.end;\n input.pinchActive[handedness] = select.active;\n }\n const activeKind = this.multiPointers[handedness].getActiveKind();\n input.directPointerActive[handedness] =\n activeKind === 'touch' || activeKind === 'grab';\n });\n this.gazePointer.update(this.gazePointer.canTarget(), delta, time, input);\n }\n}\n\n/** Copies the space's pose into the group; false (group untouched) without one. */\nfunction updatePose(\n frame: XRFrame,\n xrSpace: XRSpace,\n refSpace: XRReferenceSpace,\n group: Group,\n): boolean {\n const xrPose = frame.getPose(xrSpace, refSpace);\n if (xrPose) {\n group.matrix.fromArray(xrPose.transform.matrix);\n group.matrix.decompose(group.position, group.quaternion, group.scale);\n return true;\n }\n return false;\n}\n\n/**\n * Whether the hand's wrist has a pose this frame. A frame without\n * getJointPose, or a hand without a wrist joint, counts as tracked: this\n * check only withholds work when the runtime says the hand is not tracked.\n */\nfunction hasWristPose(\n frame: XRFrame,\n hand: XRHand,\n refSpace: XRReferenceSpace,\n): boolean {\n const wrist = hand.get('wrist');\n if (!wrist || typeof frame.getJointPose !== 'function') {\n return true;\n }\n return frame.getJointPose(wrist, refSpace) !== null;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;;;;AAKG;AA6CH,MAAM,2BAA2B,GAAG,CAAC;IACzB;AAAZ,CAAA,UAAY,iBAAiB,EAAA;AAC3B,IAAA,iBAAA,CAAA,YAAA,CAAA,GAAA,YAAyB;AACzB,IAAA,iBAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACf,CAAC,EAHW,iBAAiB,KAAjB,iBAAiB,GAAA,EAAA,CAAA,CAAA;AAStB,MAAM,oBAAoB,GAAG;IAClC,UAAU,EAAE,IAAI,UAAU,EAAE;IAC5B,MAAM,QAAQ,CAAC,SAAiB,EAAA;QAC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CAAC,WAAW,CAAC,SAAS,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC;IAC3E;AACD;AAED;AACA,SAAS,UAAU,CACjB,KAAc,EACd,OAAgB,EAChB,QAA0B,EAC1B,KAAY,EAAA;IAEZ,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC;IAC/C,IAAI,MAAM,EAAE;QACV,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC;AAC/C,QAAA,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC;AACrE,QAAA,OAAO,IAAI;IACb;AACA,IAAA,OAAO,KAAK;AACd;AAEA;;;;AAIG;AACH,SAAS,YAAY,CACnB,KAAc,EACd,IAAY,EACZ,QAA0B,EAAA;IAE1B,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC;IAC/B,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,CAAC,YAAY,KAAK,UAAU,EAAE;AACtD,QAAA,OAAO,IAAI;IACb;IACA,OAAO,KAAK,CAAC,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,KAAK,IAAI;AACrD;;;;"}
|
|
1
|
+
{"version":3,"file":"xr-input-manager.js","sources":["../src/xr-input-manager.ts"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { Signal, signal } from '@preact/signals-core';\nimport {\n Group,\n Object3D,\n PerspectiveCamera,\n Scene,\n Vector3,\n WebXRManager,\n} from 'three';\nimport { GLTF, GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';\nimport { loadInputProfile } from './gamepad/input-profiles.js';\nimport { StatefulGamepad } from './gamepad/stateful-gamepad.js';\nimport { GazePointer, GazePointerInput } from './pointer/gaze-pointer.js';\nimport { MultiPointer } from './pointer/multi-pointer.js';\nimport { XROrigin } from './rig/xr-origin.js';\nimport { XRInputVisualAdapter } from './visual/adapter/base-visual-adapter.js';\nimport { XRControllerVisualAdapter } from './visual/adapter/controller-visual-adapter.js';\nimport { XRHandVisualAdapter } from './visual/adapter/hand-visual-adapter.js';\nimport { AnimatedController } from './visual/impl/animated-controller.js';\nimport { AnimatedHand } from './visual/impl/animated-hand.js';\nimport {\n VisualConstructor,\n VisualImplementation,\n} from './visual/impl/base-impl.js';\n\ninterface InputSourceData {\n inputSource: XRInputSource;\n isPrimary: boolean;\n}\n\ninterface HandSelectEventState {\n inputSource: XRInputSource | undefined;\n actualActive: boolean;\n reportedActive: boolean;\n transitions: Array<'start' | 'end'>;\n}\n\ninterface HandSelectState {\n start: boolean;\n end: boolean;\n active: boolean;\n}\n\nconst MAX_HAND_SELECT_TRANSITIONS = 4;\nexport enum XRInputDeviceType {\n Controller = 'controller',\n Hand = 'hand',\n}\n\nexport interface XRAssetLoader {\n loadGLTF(assetPath: string): Promise<GLTF>;\n}\n\nexport const DefaultXRAssetLoader = {\n gltfLoader: new GLTFLoader(),\n async loadGLTF(assetPath: string): Promise<GLTF> {\n return await DefaultXRAssetLoader.gltfLoader.loadAsync(assetPath);\n },\n};\n\nexport interface XRInputDeviceConfig {\n handedness: XRHandedness;\n type: XRInputDeviceType;\n enabled?: boolean;\n visualClass?: VisualConstructor<VisualImplementation>;\n}\n\nexport interface XRPointerSettings {\n enabled?: boolean;\n}\n\nexport interface XRInputOptions {\n camera: PerspectiveCamera;\n scene: Scene;\n assetLoader?: XRAssetLoader;\n inputDevices?: XRInputDeviceConfig[];\n pointerSettings?: XRPointerSettings;\n}\n\nexport class XRInputManager {\n public readonly xrOrigin: XROrigin;\n\n public readonly multiPointers: Record<'left' | 'right', MultiPointer>;\n\n /**\n * Single global gaze pointer — gaze has no handedness, so it sits beside\n * {@link XRInputManager.multiPointers} rather than inside them.\n *\n * Constructed unconditionally so systems (`GrabSystem`, `GazeSystem`) can\n * hold a stable reference, but idle until {@link XRInputManager.gazeEnabled}\n * is set. Nothing here costs a frame while gaze is off.\n */\n public readonly gazePointer: GazePointer;\n\n /**\n * Master switch for the gaze pipeline, flipped on by `GazeSystem` when the\n * project opts into the gaze XR feature. While `false`, the gaze pose is\n * never sampled, no cone cast runs, no pointer events are dispatched, and\n * the pointer's reticle and ray space stay out of the rig entirely.\n */\n public get gazeEnabled(): boolean {\n return this.gazeEnabledFlag;\n }\n\n public set gazeEnabled(enabled: boolean) {\n if (enabled === this.gazeEnabledFlag) {\n return;\n }\n this.gazeEnabledFlag = enabled;\n this.resetGazeHandSelectionArming();\n if (!enabled) {\n this.gazePointer.reset();\n this.xrOrigin.clearGaze();\n }\n this.gazePointer.setAttached(enabled);\n }\n\n private gazeEnabledFlag = false;\n\n /**\n * Gaze-eligible Object3D roots, republished by the host every frame before\n * {@link XRInputManager.update}. Gaze deliberately uses an explicit\n * candidate list rather than raycasting the scene: the cone cast is\n * O(candidates), and gaze should only consider objects that opted in.\n */\n public gazeCandidates: ReadonlyArray<Object3D> = [];\n\n private readonly gazeInput: GazePointerInput = {\n candidates: [],\n pinchStart: { left: false, right: false },\n pinchEnd: { left: false, right: false },\n pinchActive: { left: false, right: false },\n directPointerActive: { left: false, right: false },\n };\n\n public readonly gamepads = {\n left: undefined,\n right: undefined,\n } as Record<'left' | 'right', StatefulGamepad | undefined>;\n\n public readonly visualAdapters: {\n controller: {\n left: XRControllerVisualAdapter;\n right: XRControllerVisualAdapter;\n };\n hand: {\n left: XRHandVisualAdapter;\n right: XRHandVisualAdapter;\n };\n left: Signal<XRInputVisualAdapter | undefined>;\n right: Signal<XRInputVisualAdapter | undefined>;\n };\n\n private activeInputSources = {\n hand: { left: undefined, right: undefined },\n controller: { left: undefined, right: undefined },\n } as Record<\n 'hand' | 'controller',\n Record<'left' | 'right', InputSourceData | undefined>\n >;\n\n private primaryInputSources = {\n left: undefined,\n right: undefined,\n } as Record<'left' | 'right', XRInputSource | undefined>;\n\n /**\n * Sides whose primary source has no pose this frame: a hand whose wrist is\n * not tracked, or a controller without a target ray pose. Their pointers\n * stay disconnected (no raycasts) and their visuals hidden until tracking\n * returns. Cleared every frame with the active sources.\n */\n private readonly untrackedPrimary = { left: false, right: false };\n\n private scene: Scene;\n private hadSession = false;\n private readonly touchSurfaceVisualOffsets = {\n left: new Vector3(),\n right: new Vector3(),\n };\n\n private processedInputSourceKeys = new Set<string>();\n\n private selectEventSession: XRSession | undefined;\n private readonly handSelectEvents: Record<\n 'left' | 'right',\n HandSelectEventState\n > = {\n left: {\n inputSource: undefined,\n actualActive: false,\n reportedActive: false,\n transitions: [],\n },\n right: {\n inputSource: undefined,\n actualActive: false,\n reportedActive: false,\n transitions: [],\n },\n };\n private readonly handSelectFrameState: Record<\n 'left' | 'right',\n HandSelectState\n > = {\n left: { start: false, end: false, active: false },\n right: { start: false, end: false, active: false },\n };\n private readonly gazeHandSelectionArmed = {\n left: false,\n right: false,\n };\n private readonly pointerDisableWarnings = new Set<\n 'left' | 'right' | 'gaze'\n >();\n private readonly selectStartHandler = (event: XRInputSourceEvent) => {\n this.updateHandSelectEvent(event, true);\n };\n private readonly selectEndHandler = (event: XRInputSourceEvent) => {\n this.updateHandSelectEvent(event, false);\n };\n\n constructor(options: XRInputOptions) {\n const { scene, camera, assetLoader } = options;\n this.xrOrigin = new XROrigin();\n this.scene = scene; // used implicitly by MultiPointer via constructor\n this.visualAdapters = {\n controller: {\n left: new XRControllerVisualAdapter(\n this.xrOrigin,\n 'left',\n true, // visuals enabled\n AnimatedController,\n scene,\n camera,\n assetLoader || DefaultXRAssetLoader,\n ),\n right: new XRControllerVisualAdapter(\n this.xrOrigin,\n 'right',\n true, // visuals enabled\n AnimatedController,\n scene,\n camera,\n assetLoader || DefaultXRAssetLoader,\n ),\n },\n hand: {\n left: new XRHandVisualAdapter(\n this.xrOrigin,\n 'left',\n true, // visuals enabled\n AnimatedHand,\n scene,\n camera,\n assetLoader || DefaultXRAssetLoader,\n ),\n right: new XRHandVisualAdapter(\n this.xrOrigin,\n 'right',\n true, // visuals enabled\n AnimatedHand,\n scene,\n camera,\n assetLoader || DefaultXRAssetLoader,\n ),\n },\n left: signal(undefined),\n right: signal(undefined),\n };\n\n this.multiPointers = {\n left: new MultiPointer('left', this.scene, camera, this.xrOrigin),\n right: new MultiPointer('right', this.scene, camera, this.xrOrigin),\n };\n\n this.gazePointer = new GazePointer(this.xrOrigin, this.scene, camera);\n }\n\n update(xrManager: WebXRManager, delta: number, time: number): void {\n const session = xrManager.getSession();\n if (!session) {\n this.syncSelectEventSession(undefined);\n if (this.hadSession) {\n this.onSessionEnded();\n } else {\n this.disablePointers(time);\n }\n this.hadSession = false;\n return;\n }\n this.hadSession = true;\n this.syncSelectEventSession(session);\n\n const refSpace = xrManager.getReferenceSpace();\n const frame = xrManager.getFrame();\n if (!refSpace || !frame) {\n this.disablePointers(time);\n return;\n }\n\n // Reset active input sources\n this.resetActiveInputSources();\n\n // Update active input sources\n this.updateActiveInputSources(session);\n\n // Update controllers and hands (poses + visuals + gamepads)\n this.updateControllersAndHands(frame, refSpace, delta);\n this.updateHandSelectFrameState();\n\n // Update head tracking\n this.xrOrigin.updateHead(frame, refSpace);\n\n // Probe the real gaze target ray while frame/refSpace are in hand, and\n // before the matrix flush below, so eyeSpace's world matrix is current by\n // the time the pointer reads it.\n if (this.gazeEnabled) {\n this.gazePointer.sampleGazePose(time, {\n frame,\n referenceSpace: refSpace,\n session,\n });\n }\n\n // Force matrix update for xrOrigin, and then update pointers\n this.xrOrigin.updateMatrixWorld(true);\n this.updatePointers(delta, time);\n\n // Gaze runs after the hand pointers so it can read their active state for\n // suppression — direct manipulation always wins over gaze.\n this.updateGazePointer(delta, time);\n }\n\n private onSessionEnded(): void {\n // Clear active sources and visuals\n this.resetActiveInputSources();\n\n // Disconnect controller/hand visuals and clear primary adapters\n (['left', 'right'] as const).forEach((handedness) => {\n const ctrl = this.visualAdapters.controller[handedness];\n const hand = this.visualAdapters.hand[handedness];\n if (ctrl.connected) {\n ctrl.disconnect();\n }\n if (hand.connected) {\n hand.disconnect();\n }\n });\n this.visualAdapters.left.value = undefined;\n this.visualAdapters.right.value = undefined;\n\n // Gaze has no per-frame source outside a session; drop it back to 'none'\n // so consumers don't read a stale tracked origin.\n this.xrOrigin.clearGaze();\n\n // Full reset (not just disable) so the next session re-runs the gaze\n // diagnostics from scratch instead of reporting the previous one's verdict.\n this.gazePointer.reset();\n\n // Hide pointer visuals and disable combined pointers\n this.disablePointers();\n }\n\n private disablePointers(time = 0): void {\n this.resetHandSelectEvents();\n this.resetHandSelectFrameState();\n this.resetGazeHandSelectionArming();\n for (const handedness of ['left', 'right'] as const) {\n try {\n this.multiPointers[handedness].update(false, 0, time);\n this.pointerDisableWarnings.delete(handedness);\n } catch (error) {\n this.warnPointerDisableFailure(handedness, error);\n }\n }\n try {\n this.gazeInput.candidates = [];\n for (const handedness of ['left', 'right'] as const) {\n this.gazeInput.pinchStart[handedness] = false;\n this.gazeInput.pinchEnd[handedness] = false;\n this.gazeInput.pinchActive[handedness] = false;\n this.gazeInput.directPointerActive[handedness] = false;\n }\n this.gazePointer.update(false, 0, time, this.gazeInput);\n this.pointerDisableWarnings.delete('gaze');\n } catch (error) {\n this.warnPointerDisableFailure('gaze', error);\n }\n }\n\n private warnPointerDisableFailure(\n pointer: 'left' | 'right' | 'gaze',\n error: unknown,\n ): void {\n if (!this.pointerDisableWarnings.has(pointer)) {\n this.pointerDisableWarnings.add(pointer);\n console.warn(`[IWSDK] Failed to disable ${pointer} pointer:`, error);\n }\n }\n\n isPrimary(deviceType: 'controller' | 'hand', handedness: 'left' | 'right') {\n return !!this.activeInputSources[deviceType][handedness]?.isPrimary;\n }\n\n /**\n * Get the primary input source for a given handedness.\n * Returns the XRInputSource that is currently active for left or right hand.\n */\n getPrimaryInputSource(\n handedness: 'left' | 'right',\n ): XRInputSource | undefined {\n return this.primaryInputSources[handedness];\n }\n\n /**\n * Get this frame's select state for the primary input source of a given\n * handedness, as the hand and gaze pointers see it. Unlike\n * `gamepads[handedness]`, this also covers hand sources that expose no\n * Gamepad, whose pinch edges come from the session's select events.\n */\n getSelectState(handedness: 'left' | 'right'): Readonly<HandSelectState> {\n return this.handSelectFrameState[handedness];\n }\n\n private resetActiveInputSources(): void {\n this.activeInputSources.controller.left = undefined;\n this.activeInputSources.controller.right = undefined;\n this.activeInputSources.hand.left = undefined;\n this.activeInputSources.hand.right = undefined;\n this.primaryInputSources.left = undefined;\n this.primaryInputSources.right = undefined;\n this.untrackedPrimary.left = false;\n this.untrackedPrimary.right = false;\n }\n\n private syncSelectEventSession(session: XRSession | undefined): void {\n if (this.selectEventSession === session) {\n return;\n }\n if (this.selectEventSession) {\n this.selectEventSession.removeEventListener(\n 'selectstart',\n this.selectStartHandler,\n );\n this.selectEventSession.removeEventListener(\n 'selectend',\n this.selectEndHandler,\n );\n }\n this.resetHandSelectEvents();\n this.resetHandSelectFrameState();\n this.resetGazeHandSelectionArming();\n this.selectEventSession = session;\n if (session) {\n session.addEventListener('selectstart', this.selectStartHandler);\n session.addEventListener('selectend', this.selectEndHandler);\n }\n }\n\n private updateHandSelectEvent(\n event: XRInputSourceEvent,\n active: boolean,\n ): void {\n const inputSource = event.inputSource;\n const handedness = inputSource.handedness;\n if (\n !inputSource.hand ||\n (handedness !== 'left' && handedness !== 'right')\n ) {\n return;\n }\n const state = this.handSelectEvents[handedness];\n if (state.inputSource !== inputSource) {\n state.inputSource = inputSource;\n state.actualActive = false;\n state.reportedActive = false;\n state.transitions.length = 0;\n }\n if (state.actualActive === active) {\n return;\n }\n state.actualActive = active;\n // Keep the newest complete gesture cycles if a suspended renderer lets\n // events outrun frames. Removing two alternating edges preserves both the\n // current reported state and the final physical state.\n if (state.transitions.length >= MAX_HAND_SELECT_TRANSITIONS) {\n state.transitions.splice(0, 2);\n }\n state.transitions.push(active ? 'start' : 'end');\n }\n\n private resetHandSelectEvents(handedness?: 'left' | 'right'): void {\n const hands = handedness ? [handedness] : (['left', 'right'] as const);\n for (const hand of hands) {\n const state = this.handSelectEvents[hand];\n state.inputSource = undefined;\n state.actualActive = false;\n state.reportedActive = false;\n state.transitions.length = 0;\n }\n }\n\n private resetHandSelectFrameState(): void {\n for (const handedness of ['left', 'right'] as const) {\n const state = this.handSelectFrameState[handedness];\n state.start = false;\n state.end = false;\n state.active = false;\n }\n }\n\n private resetGazeHandSelectionArming(): void {\n this.gazeHandSelectionArmed.left = false;\n this.gazeHandSelectionArmed.right = false;\n }\n\n /**\n * Snapshot each hand's selection once per render frame. Native hand sources\n * expose WebXR select events but no Gamepad, and both the hand pointer and\n * gaze pointer must observe the same edge without consuming it twice.\n */\n private updateHandSelectFrameState(): void {\n for (const handedness of ['left', 'right'] as const) {\n const next = this.readHandSelectState(handedness);\n const state = this.handSelectFrameState[handedness];\n state.start = next.start;\n state.end = next.end;\n state.active = next.active;\n }\n }\n\n private readHandSelectState(handedness: 'left' | 'right'): HandSelectState {\n const gamepad = this.gamepads[handedness];\n if (gamepad) {\n this.resetHandSelectEvents(handedness);\n return {\n start: gamepad.getSelectStart(),\n end: gamepad.getSelectEnd(),\n active: gamepad.getSelecting(),\n };\n }\n\n const inputSource = this.primaryInputSources[handedness];\n const state = this.handSelectEvents[handedness];\n const matches = Boolean(\n inputSource?.hand && state.inputSource === inputSource,\n );\n if (!matches) {\n this.resetHandSelectEvents(handedness);\n return { start: false, end: false, active: false };\n }\n\n // Deliver at most one edge per render frame. A short native pinch can\n // produce selectstart and selectend between two app frames; preserving\n // their order guarantees a down frame followed by an up/click frame.\n const transition = state.transitions.shift();\n if (transition === 'start') {\n state.reportedActive = true;\n } else if (transition === 'end') {\n state.reportedActive = false;\n }\n const result = {\n start: transition === 'start',\n end: transition === 'end',\n active: state.reportedActive,\n };\n return result;\n }\n\n /**\n * Updates the active input sources from the XR session.\n *\n * IMPORTANT: This method handles a platform quirk where some runtimes\n * include the same hands in BOTH session.inputSources AND session.trackedSources.\n * The duplicate entries represent the same physical hands but as different XRInputSource objects\n * with different properties (e.g., different gamepad.buttons lengths).\n *\n * To prevent the trackedSources from overwriting the isPrimary status set by inputSources,\n * we track which handedness+type combinations have already been processed and skip\n * re-processing duplicates from trackedSources.\n *\n * Without this deduplication:\n * - Hands from inputSources would be marked as isPrimary=true\n * - Then the same hands from trackedSources would overwrite with isPrimary=false\n * - This causes hand visuals to not be displayed (since visibility is tied to isPrimary)\n */\n private updateActiveInputSources(session: XRSession): void {\n this.processedInputSourceKeys.clear();\n\n // Process inputSources (these are primary)\n for (const inputSource of session.inputSources) {\n this.assignInputSource(inputSource, true);\n const key = `${inputSource.handedness}-${inputSource.hand ? 'hand' : 'controller'}`;\n this.processedInputSourceKeys.add(key);\n }\n\n // Process trackedSources (these are non-primary)\n // Skip any that were already in inputSources to avoid overwriting isPrimary\n if (session.trackedSources) {\n for (const inputSource of session.trackedSources) {\n const key = `${inputSource.handedness}-${inputSource.hand ? 'hand' : 'controller'}`;\n if (!this.processedInputSourceKeys.has(key)) {\n this.assignInputSource(inputSource, false);\n }\n }\n }\n }\n\n private assignInputSource(\n inputSource: XRInputSource,\n isPrimary: boolean,\n ): void {\n const handedness = inputSource.handedness;\n if (handedness === 'left' || handedness === 'right') {\n const target = inputSource.hand\n ? this.activeInputSources.hand\n : this.activeInputSources.controller;\n target[handedness] = { inputSource, isPrimary };\n if (isPrimary) {\n this.primaryInputSources[handedness] = inputSource;\n }\n }\n }\n\n private updateControllersAndHands(\n frame: XRFrame,\n refSpace: XRReferenceSpace,\n delta: number,\n ): void {\n (['left', 'right'] as const).forEach((handedness) => {\n (['controller', 'hand'] as const).forEach((key) => {\n const inputSourceData = this.activeInputSources[key][handedness];\n const visualAdapter = this.visualAdapters[key][handedness];\n if (inputSourceData) {\n const { inputSource, isPrimary } = inputSourceData;\n const raySpace = isPrimary\n ? this.xrOrigin.raySpaces[handedness]\n : this.xrOrigin.secondaryRaySpaces[handedness];\n const gripSpace = isPrimary\n ? this.xrOrigin.gripSpaces[handedness]\n : this.xrOrigin.secondaryGripSpaces[handedness];\n visualAdapter.raySpace = raySpace;\n visualAdapter.gripSpace = gripSpace;\n const rayTracked = updatePose(\n frame,\n inputSource.targetRaySpace,\n refSpace,\n raySpace,\n );\n // WebXR Hand Input: a hand whose wrist has no pose is not tracked,\n // whatever its target ray says. A runtime can keep listing a hand,\n // with an aim pose, while it sees no hand at all.\n const tracked = inputSource.hand\n ? hasWristPose(frame, inputSource.hand, refSpace)\n : rayTracked;\n if (isPrimary && !tracked) {\n this.untrackedPrimary[handedness] = true;\n }\n if (inputSource.gripSpace) {\n updatePose(frame, inputSource.gripSpace, refSpace, gripSpace);\n } else {\n gripSpace.position.copy(raySpace.position);\n gripSpace.quaternion.copy(raySpace.quaternion);\n gripSpace.scale.copy(raySpace.scale);\n }\n\n if (visualAdapter.inputSource !== inputSourceData.inputSource) {\n visualAdapter.connect(inputSourceData.inputSource);\n }\n if (tracked) {\n visualAdapter.update(frame, delta);\n }\n visualAdapter.isPrimary = inputSourceData.isPrimary;\n if (visualAdapter.isPrimary) {\n this.visualAdapters[handedness].value = visualAdapter;\n }\n if (visualAdapter.visual) {\n visualAdapter.visual.model.visible =\n inputSourceData.isPrimary && tracked;\n }\n\n // Update index tip space for hands (used by TouchPointer)\n if (key === 'hand' && isPrimary && tracked) {\n const handAdapter = this.visualAdapters.hand[handedness];\n const indexTipXRSpace = handAdapter.getIndexTipSpace();\n if (indexTipXRSpace) {\n updatePose(\n frame,\n indexTipXRSpace,\n refSpace,\n this.xrOrigin.indexTipSpaces[handedness],\n );\n }\n }\n } else if (visualAdapter.connected) {\n visualAdapter.disconnect();\n }\n });\n\n // For controllers, fallback indexTipSpace to raySpace (no finger tracking)\n const hasHandActive = !!this.activeInputSources.hand[handedness];\n if (!hasHandActive && this.activeInputSources.controller[handedness]) {\n const raySpace = this.xrOrigin.raySpaces[handedness];\n const indexTipSpace = this.xrOrigin.indexTipSpaces[handedness];\n indexTipSpace.position.copy(raySpace.position);\n indexTipSpace.quaternion.copy(raySpace.quaternion);\n indexTipSpace.scale.copy(raySpace.scale);\n }\n });\n (['left', 'right'] as const).forEach((handedness) => {\n const inputSource = this.primaryInputSources[handedness];\n\n // If the input source changed, clear the cached StatefulGamepad.\n if (this.gamepads[handedness]?.inputSource !== inputSource) {\n this.gamepads[handedness] = undefined;\n }\n\n const hasGamepad = !!(inputSource && inputSource.gamepad);\n\n // Lazily create a StatefulGamepad only when a gamepad is available.\n if (!this.gamepads[handedness] && hasGamepad) {\n const inputConfig = loadInputProfile(inputSource!);\n this.gamepads[handedness] = new StatefulGamepad(inputConfig);\n }\n\n // Update if present and source still has a gamepad.\n if (hasGamepad) {\n this.gamepads[handedness]?.update();\n }\n });\n }\n\n private updatePointers(delta: number, time: number) {\n // Gaze and hand/controller rays are alternative far-targeting modes in\n // ISDK. Once gaze mode has acquired a valid source, disable far rays rather than\n // letting their incidental hits compete with gaze. An invalid frame clears\n // gaze hover but does not flash the ray mode; near touch/grab stays enabled.\n const suppressFarRay =\n this.gazeEnabled && this.gazePointer.ownsFarTargeting(time);\n (['left', 'right'] as const).forEach((handedness) => {\n const inputSource = this.primaryInputSources[handedness];\n const gp = this.gamepads[handedness];\n // WebXR Hand Input requires hand sources to expose no Gamepad. Their\n // select edges come from the session-level event snapshot above. A\n // source without a pose this frame has nothing to aim with: its pointers\n // stay disconnected, so no ray, grab or touch pointer raycasts the scene.\n const connected =\n !!(inputSource && (gp || inputSource.hand)) &&\n !this.untrackedPrimary[handedness];\n const select = this.handSelectFrameState[handedness];\n const selectStart = connected ? select.start : false;\n const selectEnd = connected ? select.end : false;\n\n // First: move all registered pointers (ray + grab) via the combined pointer\n const squeezeStart = connected\n ? !!gp?.getButtonDown('xr-standard-squeeze')\n : false;\n const squeezeEnd = connected\n ? !!gp?.getButtonUp('xr-standard-squeeze')\n : false;\n // The held state too, not just the edges: a hand that replaces the\n // controller mid-squeeze reports no squeeze at all (no Gamepad, or a\n // pinch-only one), so no squeezeEnd ever comes and the grab would keep\n // that hand locked on it.\n const squeezing =\n connected && !!gp?.getButtonPressed('xr-standard-squeeze');\n this.multiPointers[handedness].update(connected, delta, time, {\n selectStart,\n selectEnd,\n squeezeStart,\n squeezeEnd,\n squeezing,\n suppressRay: suppressFarRay,\n });\n\n const touchSurfaceVisualOffset = this.multiPointers[\n handedness\n ].getTouchSurfaceVisualOffset(this.touchSurfaceVisualOffsets[handedness]);\n const handAdapter = this.visualAdapters.hand[handedness];\n if (touchSurfaceVisualOffset && handAdapter.isPrimary) {\n handAdapter.applyVisualOffsetWorld(touchSurfaceVisualOffset);\n }\n });\n }\n\n /**\n * Drive the global gaze pointer from this frame's candidates and pinch state.\n *\n * Either hand's pinch can commit a gaze selection, so both are sampled and\n * the pointer applies its own hand mutual-exclusion. Direct touch/grab state\n * feeds the pointer's suppression rule; it's read after\n * {@link XRInputManager.updatePointers} so it reflects this frame, not last.\n */\n private updateGazePointer(delta: number, time: number): void {\n if (!this.gazeEnabled) {\n return;\n }\n const input = this.gazeInput;\n input.candidates = this.gazeCandidates;\n (['left', 'right'] as const).forEach((handedness) => {\n const select = this.handSelectFrameState[handedness];\n if (!this.gazeHandSelectionArmed[handedness]) {\n // Enabling gaze while a pinch is held or queued must not turn input\n // that occurred while gaze was off into a synthetic gaze click. Arm\n // only after the event bridge reaches a fully released baseline.\n const events = this.handSelectEvents[handedness];\n if (!select.active && events.transitions.length === 0) {\n this.gazeHandSelectionArmed[handedness] = true;\n }\n input.pinchStart[handedness] = false;\n input.pinchEnd[handedness] = false;\n input.pinchActive[handedness] = false;\n } else {\n input.pinchStart[handedness] = select.start;\n input.pinchEnd[handedness] = select.end;\n input.pinchActive[handedness] = select.active;\n }\n const activeKind = this.multiPointers[handedness].getActiveKind();\n input.directPointerActive[handedness] =\n activeKind === 'touch' || activeKind === 'grab';\n });\n this.gazePointer.update(this.gazePointer.canTarget(), delta, time, input);\n }\n}\n\n/** Copies the space's pose into the group; false (group untouched) without one. */\nfunction updatePose(\n frame: XRFrame,\n xrSpace: XRSpace,\n refSpace: XRReferenceSpace,\n group: Group,\n): boolean {\n const xrPose = frame.getPose(xrSpace, refSpace);\n if (xrPose) {\n group.matrix.fromArray(xrPose.transform.matrix);\n group.matrix.decompose(group.position, group.quaternion, group.scale);\n return true;\n }\n return false;\n}\n\n/**\n * Whether the hand's wrist has a pose this frame. A frame without\n * getJointPose, or a hand without a wrist joint, counts as tracked: this\n * check only withholds work when the runtime says the hand is not tracked.\n */\nfunction hasWristPose(\n frame: XRFrame,\n hand: XRHand,\n refSpace: XRReferenceSpace,\n): boolean {\n const wrist = hand.get('wrist');\n if (!wrist || typeof frame.getJointPose !== 'function') {\n return true;\n }\n return frame.getJointPose(wrist, refSpace) !== null;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;;;;AAKG;AA6CH,MAAM,2BAA2B,GAAG,CAAC;IACzB;AAAZ,CAAA,UAAY,iBAAiB,EAAA;AAC3B,IAAA,iBAAA,CAAA,YAAA,CAAA,GAAA,YAAyB;AACzB,IAAA,iBAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACf,CAAC,EAHW,iBAAiB,KAAjB,iBAAiB,GAAA,EAAA,CAAA,CAAA;AAStB,MAAM,oBAAoB,GAAG;IAClC,UAAU,EAAE,IAAI,UAAU,EAAE;IAC5B,MAAM,QAAQ,CAAC,SAAiB,EAAA;QAC9B,OAAO,MAAM,oBAAoB,CAAC,UAAU,CAAC,SAAS,CAAC,SAAS,CAAC;IACnE,CAAC;;MAsBU,cAAc,CAAA;AAezB;;;;;AAKG;AACH,IAAA,IAAW,WAAW,GAAA;QACpB,OAAO,IAAI,CAAC,eAAe;IAC7B;IAEA,IAAW,WAAW,CAAC,OAAgB,EAAA;AACrC,QAAA,IAAI,OAAO,KAAK,IAAI,CAAC,eAAe,EAAE;YACpC;QACF;AACA,QAAA,IAAI,CAAC,eAAe,GAAG,OAAO;QAC9B,IAAI,CAAC,4BAA4B,EAAE;QACn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AAG,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC;IAC/C,IAAI,MAAM,EAAE;QACV,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC;AAC/C,QAAA,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC;AACrE,QAAA,OAAO,IAAI;IACb;AACA,IAAA,OAAO,KAAK;AACd;AAEA;;;;AAIG;AACH,SAAS,YAAY,CACnB,KAAc,EACd,IAAY,EACZ,QAA0B,EAAA;IAE1B,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC;IAC/B,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,CAAC,YAAY,KAAK,UAAU,EAAE;AACtD,QAAA,OAAO,IAAI;IACb;IACA,OAAO,KAAK,CAAC,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,KAAK,IAAI;AACrD;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iwsdk/xr-input",
|
|
3
|
-
"version": "1.2.0-rc.
|
|
3
|
+
"version": "1.2.0-rc.2",
|
|
4
4
|
"description": "WebXR input system with controller and hand tracking support, visual adapters, and input profiles for Three.js applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|