hud-11: one pointer owner (dominant hand, press takes over) + hand isolation

ADDENDUM 12. The pointer was symmetric: whoever acted last owned it, and when
neither had acted the first source in runtime order won - the LEFT hand on this
runtime, so a right-handed user's guide line sat on the non-dominant hand.

- state.handPref ('right'|'left', default 'right') is the default owner. Set from the
  pre-VR panel (操作 -> 主用手), persisted. pickPointerCand(cands, preferKey,
  ownerKey, prefHand): acting source owns the shot (or MISSes), else owner aiming ->
  preferred hand aiming -> any hand aiming -> owner -> preferred hand -> first.
- A press takes the pointer over and the owner sticks while it is aiming.
- Hold exclusion: while a grab/viewDrag started by one source is active, a press from
  the other source is ignored (pressAt "IGNORED (other hand is holding)").
- Source-matched release: pointerUp(src) only ends the hold src started. It used to be
  argument-less, so either hand's release cancelled the other hand's subtitle grab or
  picture pan. grab/viewDrag now carry a key; onSelectEnd(ev) and pollGamepads pass
  their source.
- dropStaleHolds() runs each frame and ends a hold whose source left
  session.inputSources (tracking lost), so nothing sticks.

New diagnostics: stats.handPref, stats.owner.

Verified with injected synthetic input sources:
  default (right), both on panel     pointer hand:right HIT 0.78,0.50  (was hand:left)
  handPref=left, fresh session       pointer hand:left  HIT 0.22,0.50
  left press, release                owner hand:left, stays left
  right holds picture-pan, left press    "IGNORED (other hand is holding)"
  right holds picture-pan, LEFT release  viewDrag stays armed (drag survives)
  right holds picture-pan, RIGHT release viewDrag reset (tap) (drag ends)
This commit is contained in:
2026-10-12 21:36:03 +08:00
parent e18c3d51bd
commit 0713f35513
5 changed files with 250 additions and 49 deletions
+2 -1
View File
@@ -11,7 +11,7 @@
var NS = window.__JFVR = window.__JFVR || {};
NS.version = 'hud-10'; // hud-10 = ADDENDUM 11 (pointer follows the acting/aiming hand) + ADDENDUM 10 (native subtitles) + 9
NS.version = 'hud-11'; // hud-11 = ADDENDUM 12 (single pointer owner: dominant hand by default, press takes over, hold exclusion) + 11/10/9
NS.__core = true;
/* ------------------------------------------------------------------ *
@@ -67,6 +67,7 @@
subAngleDeg: 69.2,
controls: true,
handPref: 'right', // ADDENDUM 12: dominant hand = the pointer's default owner
ctlAutoHideMs: 4000, // in-VR control bar auto-hide
// written every XR frame by 90-main.js, read by modules