@iwsdk/xr-input 1.1.0 → 1.2.0-rc.1

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.
@@ -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; neither latch is reset because MultiPointer
69
- * never calls `Pointer.exit()` on these long-lived instances.
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);
@@ -234,9 +255,14 @@ class MultiPointer {
234
255
  // Touch pointer
235
256
  if (this.pointerStates.get('touch') !== InteractorState.DISABLED) {
236
257
  this.sceneWithDescendants.interactableDescendants =
237
- this.sceneWithDescendants.touchDescendants;
238
- this.touch.pointer.move(this.scene, this.nativeEvent);
239
- this.markPointerMoved('touch', this.touch.pointer);
258
+ this.touchCandidates();
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;
@@ -258,7 +284,7 @@ class MultiPointer {
258
284
  break;
259
285
  case 'touch':
260
286
  this.sceneWithDescendants.interactableDescendants =
261
- this.sceneWithDescendants.touchDescendants;
287
+ this.touchCandidates();
262
288
  break;
263
289
  }
264
290
  pointer.move(this.scene, this.nativeEvent);
@@ -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
- this.processButtonLifecycle(entry, state, !!(input === null || input === void 0 ? void 0 : input.squeezeStart), !!(input === null || input === void 0 ? void 0 : input.squeezeEnd), 2);
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
@@ -411,6 +531,15 @@ class MultiPointer {
411
531
  if (state === InteractorState.HOVER) {
412
532
  this.pointerStates.set(this.activeKind, InteractorState.NORMAL);
413
533
  }
534
+ // The selected object went away (e.g. the app disposed it) and the
535
+ // button was released off any target. Release anyway, as the touch
536
+ // lifecycle does, or the selection lock never ends.
537
+ if (state === InteractorState.SELECT && buttonUp) {
538
+ this.buttonEvent.timeStamp = this.nativeEvent.timeStamp;
539
+ this.buttonEvent.button = button;
540
+ entry.pointer.up(this.buttonEvent);
541
+ this.pointerStates.set(this.activeKind, InteractorState.NORMAL);
542
+ }
414
543
  return;
415
544
  }
416
545
  // HOVER → SELECT on button down
@@ -435,6 +564,11 @@ class MultiPointer {
435
564
  /**
436
565
  * Get the policy for ray visual rendering
437
566
  */
567
+ /** Objects this hand may poke: its own list when the scene has one. */
568
+ touchCandidates() {
569
+ var _a, _b;
570
+ return ((_b = (_a = this.sceneWithDescendants.touchDescendantsByHand) === null || _a === void 0 ? void 0 : _a[this.handedness]) !== null && _b !== void 0 ? _b : this.sceneWithDescendants.touchDescendants);
571
+ }
438
572
  getPolicyForRay() {
439
573
  return { forceHideRay: this.shouldHideRay() };
440
574
  }
@@ -530,6 +664,13 @@ class MultiPointer {
530
664
  if (!ptr) {
531
665
  return;
532
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
+ }
533
674
  const button = kind === 'select' ? 0 : 2;
534
675
  ptr.down({ button, timeStamp: nativeEvent.timeStamp });
535
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 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.sceneWithDescendants.touchDescendants;\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.sceneWithDescendants.touchDescendants;\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 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 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,GAA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,gBAAA,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO;YAC3B;;YAEA,OAAO,IAAI,CAAC;kBACR,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AACjC,kBAAE,IAAI,CAAC,GAAG,CAAC,OAAO;QACtB;AACA,QAAA,IAAI,MAAM,KAAK,KAAK,EAAE;AACpB,YAAA,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO;QACzB;AACA,QAAA,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO;IAC1B;AAEA;;AAEG;AACK,IAAA,QAAQ,CACd,IAAiB,EAAA;QAEjB,QAAQ,IAAI;AACV,YAAA,KAAK,KAAK;gBACR,OAAO,IAAI,CAAC,GAAG;AACjB,YAAA,KAAK,MAAM;gBACT,OAAO,IAAI,CAAC,IAAI;AAClB,YAAA,KAAK,OAAO;gBACV,OAAO,IAAI,CAAC,KAAK;;IAEvB;AAEA;;;AAGG;IACH,OAAO,GAAA;;AAEL,QAAA,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE;;AAG3B,QAAA,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE;;AAGzB,QAAA,IAAI,CAAC,aAAa,CAAC,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;AAE9D;;AAEG;AACH,MAAM,gBAAgB,GAAG;IACvB,kBAAkB,EAAE,IAAI;IACxB,iBAAiB,EAAE,GAAG;CACvB;AAED,MAAM,8BAA8B,GAAG,QAAQ;AAQ/C;;;;;;;;;;AAUG;MACU,YAAY,CAAA;AAqDvB,IAAA,WAAA,CACmB,UAA4B,EAC5B,KAAe,EACf,MAAyB,EACzB,QAAkB,EAAA;QAHlB,IAAA,CAAA,UAAU,GAAV,UAAU;QACV,IAAA,CAAA,KAAK,GAAL,KAAK;QACL,IAAA,CAAA,MAAM,GAAN,MAAM;QACN,IAAA,CAAA,QAAQ,GAAR,QAAQ;;QAlDnB,IAAA,CAAA,UAAU,GAAuB,IAAI;;AAGrC,QAAA,IAAA,CAAA,aAAa,GAAsC,IAAI,GAA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,EAClB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,OAAO,EACpB,SAAS,EAAE,OAAO,EAClB,MAAM,CAAC,EAAE;QAAE,YAAY,CAAC,EAAE,OAAO,CAAA;KAAE;IAmBrC,OAAO,CAAC,sBAAsB;IAgC9B,IAAI,IAAI,YAEP;IAED;;OAEG;IACH,OAAO,IAAI,IAAI;CAKhB"}
@@ -53,6 +53,9 @@ class RayPointer {
53
53
  const raycaster = this.pointer.intersector.raycaster;
54
54
  if (raycaster) {
55
55
  raycaster.firstHitOnly = true;
56
+ // Sprite.raycast needs the viewing camera, and the XR ray intersector
57
+ // never sets one (the screen intersector does, via setFromCamera).
58
+ raycaster.camera = camera;
56
59
  }
57
60
  this.ray = new Mesh(new CylinderGeometry(0.001, 0.001, 1, 6, 1, true)
58
61
  .translate(0, 0.5, 0)
@@ -1 +1 @@
1
- {"version":3,"file":"ray-pointer.js","sources":["../../src/pointer/ray-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, createRayPointer } from '@pmndrs/pointer-events';\nimport {\n Color,\n CylinderGeometry,\n Intersection,\n MathUtils,\n Mesh,\n PerspectiveCamera,\n ShaderMaterial,\n} from 'three';\nimport { XROrigin } from '../rig/xr-origin.js';\nimport { isObjectTreeVisible } from './visibility.js';\n\nconst { lerp } = MathUtils;\n\nconst vertexShader = `\n varying float vPosition;\n void main() {\n vPosition = (position.z + 1.0) / 1.0;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n`;\n\nconst fragmentShader = `\n uniform float endValue;\n uniform float opacity;\n uniform vec3 color;\n varying float vPosition;\n void main() {\n float alpha = vPosition < endValue ? smoothstep(endValue-0.05, endValue, vPosition) :\n vPosition < 0.97 ? 1.0 :\n 1.0 - smoothstep(0.97, 1.0, vPosition);\n gl_FragColor = vec4(color, alpha * opacity);\n }\n`;\n\nconst rayPressedColor = new Color(0x3383e6);\nconst rayDefaultColor = new Color(0xffffff);\n\nexport enum RayDisplayMode {\n Visible = 1,\n VisibleOnIntersection = 2,\n Invisible = 3,\n}\n\nexport class RayPointer {\n public pointer: Pointer;\n public ray: Mesh<CylinderGeometry, ShaderMaterial>;\n public enabled = true;\n public rayIntersection: Intersection | undefined;\n public rayDisplayMode: RayDisplayMode = RayDisplayMode.VisibleOnIntersection;\n\n constructor(\n camera: PerspectiveCamera,\n xrOrigin: XROrigin,\n handedness: 'left' | 'right',\n ) {\n this.pointer = createRayPointer(\n () => camera,\n { current: xrOrigin.raySpaces[handedness] },\n {},\n {\n filter: isObjectTreeVisible,\n // XR trigger presses are commonly longer than a mouse click, especially\n // through controller emulation. Match the poke pointer's forgiving\n // activation window so a normal select gesture reaches child UI clicks.\n clickThresholdMs: 800,\n // Disable contextmenu on button 2 (squeeze) to avoid spurious events\n contextMenuButton: -1,\n },\n );\n\n // Optimize raycaster for BVH acceleration - only get first hit for better performance\n const raycaster = (this.pointer.intersector as any).raycaster;\n if (raycaster) {\n raycaster.firstHitOnly = true;\n }\n this.ray = new Mesh(\n new CylinderGeometry(0.001, 0.001, 1, 6, 1, true)\n .translate(0, 0.5, 0)\n .rotateX(-Math.PI / 2),\n new ShaderMaterial({\n vertexShader: vertexShader,\n fragmentShader: fragmentShader,\n transparent: true,\n depthWrite: false,\n uniforms: {\n endValue: { value: 0.75 },\n color: { value: new Color().copy(rayDefaultColor) },\n opacity: { value: 0 },\n },\n }),\n );\n this.ray.visible = false;\n this.ray.renderOrder = 0;\n xrOrigin.raySpaces[handedness].add(this.ray);\n }\n\n update(\n connected: boolean,\n delta: number,\n _time: number,\n selectStart: boolean,\n selectEnd: boolean,\n policy?: { forceHideRay?: boolean },\n ) {\n // CombinedPointer is responsible for moving/enabling; we only render visuals\n // CombinedPointer controls actual pointer enablement; reflect that in visuals\n const pointerEnabled = this.pointer.getEnabled();\n const active = pointerEnabled && connected && this.enabled;\n this.ray.visible = active && !policy?.forceHideRay;\n\n if (active) {\n if (pointerEnabled && selectStart) {\n this.ray.material.uniforms.color.value.copy(rayPressedColor);\n } else if (pointerEnabled && selectEnd) {\n this.ray.material.uniforms.color.value.copy(rayDefaultColor);\n }\n // Movement is handled by the owning CombinedPointer aggregator\n }\n this.updatePointerRendering(active, delta);\n }\n\n private updatePointerRendering(pointerActive: boolean, delta = 1) {\n let rayOpacityTarget = 0;\n if (pointerActive) {\n const intersection = this.pointer.getIntersection();\n const intersectionValid = !!(\n intersection && !intersection.object.isVoidObject\n );\n this.rayIntersection = intersectionValid ? intersection : undefined;\n switch (this.rayDisplayMode) {\n case RayDisplayMode.Visible:\n rayOpacityTarget = 1;\n break;\n case RayDisplayMode.Invisible:\n rayOpacityTarget = 0;\n break;\n default:\n rayOpacityTarget = intersectionValid ? 1 : 0;\n }\n if (intersectionValid) {\n this.ray.material.uniforms.endValue.value =\n 1.05 - Math.min(0.3, intersection.distance);\n }\n } else {\n this.rayIntersection = undefined;\n }\n this.ray.material.uniforms.opacity.value = lerp(\n this.ray.material.uniforms.opacity.value,\n rayOpacityTarget,\n delta * 10,\n );\n }\n\n get busy() {\n return !!this.rayIntersection;\n }\n\n /**\n * Dispose of ray pointer resources.\n */\n dispose(): void {\n this.ray.geometry.dispose();\n this.ray.material.dispose();\n this.ray.removeFromParent();\n }\n}\n"],"names":[],"mappings":";;;;AAAA;;;;;AAKG;AAeH,MAAM,EAAE,IAAI,EAAE,GAAG,SAAS;AAE1B,MAAM,YAAY,GAAG;;;;;;CAMpB;AAED,MAAM,cAAc,GAAG;;;;;;;;;;;CAWtB;AAED,MAAM,eAAe,GAAG,IAAI,KAAK,CAAC,QAAQ,CAAC;AAC3C,MAAM,eAAe,GAAG,IAAI,KAAK,CAAC,QAAQ,CAAC;IAE/B;AAAZ,CAAA,UAAY,cAAc,EAAA;AACxB,IAAA,cAAA,CAAA,cAAA,CAAA,SAAA,CAAA,GAAA,CAA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B,QAAA,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,EAAE;AAC3B,QAAA,IAAI,CAAC,GAAG,CAAC,gBAAgB,EAAE;IAC7B;AACD;;;;"}
1
+ {"version":3,"file":"ray-pointer.js","sources":["../../src/pointer/ray-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, createRayPointer } from '@pmndrs/pointer-events';\nimport {\n Color,\n CylinderGeometry,\n Intersection,\n MathUtils,\n Mesh,\n PerspectiveCamera,\n ShaderMaterial,\n} from 'three';\nimport { XROrigin } from '../rig/xr-origin.js';\nimport { isObjectTreeVisible } from './visibility.js';\n\nconst { lerp } = MathUtils;\n\nconst vertexShader = `\n varying float vPosition;\n void main() {\n vPosition = (position.z + 1.0) / 1.0;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n`;\n\nconst fragmentShader = `\n uniform float endValue;\n uniform float opacity;\n uniform vec3 color;\n varying float vPosition;\n void main() {\n float alpha = vPosition < endValue ? smoothstep(endValue-0.05, endValue, vPosition) :\n vPosition < 0.97 ? 1.0 :\n 1.0 - smoothstep(0.97, 1.0, vPosition);\n gl_FragColor = vec4(color, alpha * opacity);\n }\n`;\n\nconst rayPressedColor = new Color(0x3383e6);\nconst rayDefaultColor = new Color(0xffffff);\n\nexport enum RayDisplayMode {\n Visible = 1,\n VisibleOnIntersection = 2,\n Invisible = 3,\n}\n\nexport class RayPointer {\n public pointer: Pointer;\n public ray: Mesh<CylinderGeometry, ShaderMaterial>;\n public enabled = true;\n public rayIntersection: Intersection | undefined;\n public rayDisplayMode: RayDisplayMode = RayDisplayMode.VisibleOnIntersection;\n\n constructor(\n camera: PerspectiveCamera,\n xrOrigin: XROrigin,\n handedness: 'left' | 'right',\n ) {\n this.pointer = createRayPointer(\n () => camera,\n { current: xrOrigin.raySpaces[handedness] },\n {},\n {\n filter: isObjectTreeVisible,\n // XR trigger presses are commonly longer than a mouse click, especially\n // through controller emulation. Match the poke pointer's forgiving\n // activation window so a normal select gesture reaches child UI clicks.\n clickThresholdMs: 800,\n // Disable contextmenu on button 2 (squeeze) to avoid spurious events\n contextMenuButton: -1,\n },\n );\n\n // Optimize raycaster for BVH acceleration - only get first hit for better performance\n const raycaster = (this.pointer.intersector as any).raycaster;\n if (raycaster) {\n raycaster.firstHitOnly = true;\n // Sprite.raycast needs the viewing camera, and the XR ray intersector\n // never sets one (the screen intersector does, via setFromCamera).\n raycaster.camera = camera;\n }\n this.ray = new Mesh(\n new CylinderGeometry(0.001, 0.001, 1, 6, 1, true)\n .translate(0, 0.5, 0)\n .rotateX(-Math.PI / 2),\n new ShaderMaterial({\n vertexShader: vertexShader,\n fragmentShader: fragmentShader,\n transparent: true,\n depthWrite: false,\n uniforms: {\n endValue: { value: 0.75 },\n color: { value: new Color().copy(rayDefaultColor) },\n opacity: { value: 0 },\n },\n }),\n );\n this.ray.visible = false;\n this.ray.renderOrder = 0;\n xrOrigin.raySpaces[handedness].add(this.ray);\n }\n\n update(\n connected: boolean,\n delta: number,\n _time: number,\n selectStart: boolean,\n selectEnd: boolean,\n policy?: { forceHideRay?: boolean },\n ) {\n // CombinedPointer is responsible for moving/enabling; we only render visuals\n // CombinedPointer controls actual pointer enablement; reflect that in visuals\n const pointerEnabled = this.pointer.getEnabled();\n const active = pointerEnabled && connected && this.enabled;\n this.ray.visible = active && !policy?.forceHideRay;\n\n if (active) {\n if (pointerEnabled && selectStart) {\n this.ray.material.uniforms.color.value.copy(rayPressedColor);\n } else if (pointerEnabled && selectEnd) {\n this.ray.material.uniforms.color.value.copy(rayDefaultColor);\n }\n // Movement is handled by the owning CombinedPointer aggregator\n }\n this.updatePointerRendering(active, delta);\n }\n\n private updatePointerRendering(pointerActive: boolean, delta = 1) {\n let rayOpacityTarget = 0;\n if (pointerActive) {\n const intersection = this.pointer.getIntersection();\n const intersectionValid = !!(\n intersection && !intersection.object.isVoidObject\n );\n this.rayIntersection = intersectionValid ? intersection : undefined;\n switch (this.rayDisplayMode) {\n case RayDisplayMode.Visible:\n rayOpacityTarget = 1;\n break;\n case RayDisplayMode.Invisible:\n rayOpacityTarget = 0;\n break;\n default:\n rayOpacityTarget = intersectionValid ? 1 : 0;\n }\n if (intersectionValid) {\n this.ray.material.uniforms.endValue.value =\n 1.05 - Math.min(0.3, intersection.distance);\n }\n } else {\n this.rayIntersection = undefined;\n }\n this.ray.material.uniforms.opacity.value = lerp(\n this.ray.material.uniforms.opacity.value,\n rayOpacityTarget,\n delta * 10,\n );\n }\n\n get busy() {\n return !!this.rayIntersection;\n }\n\n /**\n * Dispose of ray pointer resources.\n */\n dispose(): void {\n this.ray.geometry.dispose();\n this.ray.material.dispose();\n this.ray.removeFromParent();\n }\n}\n"],"names":[],"mappings":";;;;AAAA;;;;;AAKG;AAeH,MAAM,EAAE,IAAI,EAAE,GAAG,SAAS;AAE1B,MAAM,YAAY,GAAG;;;;;;CAMpB;AAED,MAAM,cAAc,GAAG;;;;;;;;;;;CAWtB;AAED,MAAM,eAAe,GAAG,IAAI,KAAK,CAAC,QAAQ,CAAC;AAC3C,MAAM,eAAe,GAAG,IAAI,KAAK,CAAC,QAAQ,CAAC;IAE/B;AAAZ,CAAA,UAAY,cAAc,EAAA;AACxB,IAAA,cAAA,CAAA,cAAA,CAAA,SAAA,CAAA,GAAA,CAAA,CAAA,GAAA,SAAW;AACX,IAAA,cAAA,CAAA,cAAA,CAAA,uBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,uBAAyB;AACzB,IAAA,cAAA,CAAA,cAAA,CAAA,WAAA,CAAA,GAAA,CAAA,CAAA,GAAA,WAAa;AACf,CAAC,EAJW,cAAc,KAAd,cAAc,GAAA,EAAA,CAAA,CAAA;MAMb,UAAU,CAAA;AAOrB,IAAA,WAAA,CACE,MAAyB,EACzB,QAAkB,EAClB,UAA4B,EAAA;QAPvB,IAAA,CAAA,OAAO,GAA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AC,eAAe,GAAG,iBAAiB,GAAG,YAAY,GAAG,SAAS;AACnE,YAAA,QAAQ,IAAI,CAAC,cAAc;gBACzB,KAAK,cAAc,CAAC,OAAO;oBACzB,gBAAgB,GAAG,CAAC;oBACpB;gBACF,KAAK,cAAc,CAAC,SAAS;oBAC3B,gBAAgB,GAAG,CAAC;oBACpB;AACF,gBAAA;oBACE,gBAAgB,GAAG,iBAAiB,GAAG,CAAC,GAAG,CAAC;;YAEhD,IAAI,iBAAiB,EAAE;gBACrB,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK;oBACvC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,YAAY,CAAC,QAAQ,CAAC;YAC/C;QACF;aAAO;AACL,YAAA,IAAI,CAAC,eAAe,GAAG,SAAS;QAClC;AACA,QAAA,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,GAAG,IAAI,CAC7C,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,EACxC,gBAAgB,EAChB,KAAK,GAAG,EAAE,CACX;IACH;AAEA,IAAA,IAAI,IAAI,GAAA;AACN,QAAA,OAAO,CAAC,CAAC,IAAI,CAAC,eAAe;IAC/B;AAEA;;AAEG;IACH,OAAO,GAAA;AACL,QAAA,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,EAAE;AAC3B,QAAA,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,EAAE;AAC3B,QAAA,IAAI,CAAC,GAAG,CAAC,gBAAgB,EAAE;IAC7B;AACD;;;;"}
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.1.0";
1
+ export declare const VERSION = "1.2.0-rc.1";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"xr-input-manager.d.ts","source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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"}
@@ -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]);