Skip to main content

Interface: TouchPressOptions

Defined in: webxr-uiextensions/src/core/touch-press.ts:30

Touch press - the press / hold / release state machine for a near (poke) pointer against a panel, pure logic with no engine imports.

Why it exists. Engines measure a fingertip's distance to a panel without a sign, so 2 cm behind a panel reads like 2 cm in front. A finger pushed through a panel and pulled back out therefore fires press, release, press, release: two clicks for one gesture. Worse, a finger arriving from behind presses too. This machine works on SIGNED distance (positive in front) and holds three guarantees:

  1. A press starts only from the front. A fingertip that is first seen behind the panel, or that crosses the press band from behind, never presses.
  2. Once pressed, the touch is HELD until a release: however deep the finger goes and whichever way it comes back, no second press can start until released has been reported.
  3. Release happens when the fingertip comes back out in FRONT past the release distance (hysteresis, so a finger resting on the surface does not chatter), or when contact is lost entirely (hover gone, tracking dropped).

Targets. The machine records what was under the finger at the press and reports what is under it at the release, because they can differ: a finger that enters one button and leaves through its neighbour. Whether that counts as a click of either is the adapter's (or the engine's) rule; the machine only makes both ends visible so that rule can be applied.

Properties

PropertyTypeDescriptionDefined in
allowFromBehindbooleanLet a fingertip arriving from behind the panel press. Off by default.webxr-uiextensions/src/core/touch-press.ts:36
pressDistancenumberSigned distance (meters, positive in front) at or under which a press starts.webxr-uiextensions/src/core/touch-press.ts:32
releaseDistancenumberSigned distance in front the finger must return past for a release. Never less than pressDistance.webxr-uiextensions/src/core/touch-press.ts:34