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:
@@ -1236,3 +1236,58 @@ both hands off panel state.pointer.hit = null
|
||||
both off panel, right press pressSrc hand:right pressPtr "hand:right nohit"
|
||||
pressAt "MISS (no hit on the panel)" (did NOT use the left hand)
|
||||
```
|
||||
|
||||
# ADDENDUM 12 — one pointer owner: the dominant hand, taken over by a press
|
||||
|
||||
The pointer was symmetric: whichever hand acted last owned it, and when neither had
|
||||
acted the first source in runtime order won — which is the LEFT hand on this runtime, so
|
||||
a right-handed user's guide line sat on the non-dominant hand. Two hands could also
|
||||
disturb each other's holds.
|
||||
|
||||
## 1. One owner (a mouse-like single cursor)
|
||||
|
||||
`pickPointerCand(cands, preferKey, ownerKey, prefHand)`:
|
||||
|
||||
```
|
||||
preferKey (the acting source) -> that source, or null => the press MISSES
|
||||
owner aiming at the panel -> owner
|
||||
the preferred hand aiming at the panel -> preferred hand
|
||||
any hand aiming at the panel -> that hand
|
||||
owner (not aiming) -> owner
|
||||
the preferred hand (not aiming) -> preferred hand
|
||||
-> the first source
|
||||
```
|
||||
|
||||
- **`state.handPref`** (`'right' | 'left'`, default `'right'`) is the pointer's default
|
||||
owner — the dominant hand. Set from the pre-VR panel ("操作 → 主用手"), persisted in
|
||||
`jfvr.settings.v1`. It applies at the start of a session; during a session the owner
|
||||
simply sticks.
|
||||
- **A press takes the pointer over** (`preferKey`), and the owner then sticks to that
|
||||
hand while it is aiming.
|
||||
|
||||
## 2. The hands can no longer disturb each other
|
||||
|
||||
- **Hold exclusion:** while a hold/drag started by one source is in progress
|
||||
(`grab` / `viewDrag`), a press from the OTHER source is ignored
|
||||
(`stats.pressAt = 'IGNORED (other hand is holding)'`).
|
||||
- **Source-matched release:** `pointerUp(src)` only ends a hold that `src` started.
|
||||
It used to be argument-less, so *either* hand's release cancelled the other hand's
|
||||
subtitle grab / picture pan. `onSelectEnd(ev)` and `pollGamepads` now pass their
|
||||
source. `grab` / `viewDrag` carry a `key`.
|
||||
- **Stale holds:** `dropStaleHolds()` runs each frame and ends a hold whose source has
|
||||
left `session.inputSources` (hand tracking lost) — otherwise no release would ever
|
||||
arrive and the drag would stick.
|
||||
|
||||
New diagnostics: `stats.handPref`, `stats.owner` (= `stats.activeSrc`), plus the
|
||||
existing `pressSrc` / `pressPtr`.
|
||||
|
||||
## Verification (injected synthetic input sources, live session)
|
||||
|
||||
```
|
||||
default (handPref=right), both hands on panel pointer hand:right HIT 0.78,0.50 (was hand:left)
|
||||
handPref=left (persisted, fresh session) pointer hand:left HIT 0.22,0.50
|
||||
left press, release owner hand:left, still left afterwards
|
||||
right holds picture-pan, left press pressAt "IGNORED (other hand is holding)"
|
||||
right holds picture-pan, LEFT releases viewDrag stays "armed" (drag survives)
|
||||
right holds picture-pan, RIGHT releases viewDrag "reset (tap)" (drag ends)
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user