hud-10 (rev3): cursor on the guide line; a press is attributed to the acting hand

ADDENDUM 11b, both reported against ADDENDUM 11.

1. The cursor drifted off the guide line, worse near the panel edge. panelHit()
   clamps an off-panel intersection to the border and flags it via inBounds, but
   updatePointer() published that clamped nx,ny as pointer.hit, so the ring was
   drawn on the border while the beam ended at the true (off-panel) intersection.
   pointer.hit is now published only when inBounds; distance is still published so
   an edge-aimed beam reaches the plane (beamLength no longer requires p.hit).
   Near-misses still summon the bar, but no longer press.

2. A right-hand press could still act at the left hand's position, for three
   separate reasons: the activate cooldown was global (a gamepad edge from one hand
   swallowed the other hand's select - now per input source); a missing ray fell
   back to another hand (with a preferKey the acting source now owns the shot and
   a missing candidate MISSes); and a null frame skipped re-attribution entirely
   (now falls back to S.lastFrame and MISSes if the acting source yields no
   pointer).

New diagnostics: stats.pressSrc, stats.pressPtr.

Verified with injected synthetic input sources:
  both on panel, right press      pressSrc hand:right  pressAt 0.78,0.50  seek 79.5%
  left press then right 100ms     pressSrc hand:right  pressAt 0.78,0.50  (not swallowed)
  both off panel                  state.pointer.hit = null (no clamped cursor)
  off panel, right press          pressPtr "hand:right nohit"  MISS (no hit on the panel)
This commit is contained in:
2026-10-12 21:07:05 +08:00
parent 5eb679f6ca
commit e18c3d51bd
5 changed files with 176 additions and 14 deletions
+4 -1
View File
@@ -1532,8 +1532,11 @@
return d > 0 ? d : null;
}
// ADDENDUM 11b: the beam reaches the panel plane whenever the ray meets it,
// even when the intersection is off the panel (there is simply no cursor then).
// Previously it fell back to a fixed length without a hit, so an edge-aimed
// beam stopped short of the plane while the cursor was clamped to the border.
function beamLength(p) {
if (!p.hit) return BEAM_L_DEFAULT;
var d = num(p.distance);
if (d == null) d = panelDistance(p);
if (d == null || !(d > BEAM_L_MIN)) return BEAM_L_DEFAULT;