Skip to content

Read the wheel and pointer lock in Pointer, and rename Touch.track to Touch.actions - #64

Merged
SandroMaglione merged 1 commit into
mainfrom
feat/pointer-wheel-lock
Oct 23, 2026
Merged

SandroMaglione merged 1 commit into
mainfrom
feat/pointer-wheel-lock

Conversation

@SandroMaglione

Copy link
Copy Markdown
Member

Why

These are the three items deferred from #63:

  • The wheel is used for zoom (which needs the scroll amount) and for stepping actions like next weapon (which need a pulse that merges with a gamepad bumper).
  • Mouse look needs raw motion and a pointer lock.
  • Touch.track was the only device not built as X.actions.

What

Wheel

  • wheel is how far the wheel scrolled since the previous snapshot, in CSS px; lines and pages are converted.
  • wheelUp/wheelDown/wheelLeft/wheelRight are bindable buttons. They pulse (pressed and released in one window) once per Pointer.wheelStep (100 px). Small trackpad scrolls add up toward a pulse, and the count starts over when the direction turns.
  • preventScroll (default true) keeps the page from scrolling over the element.

Mouse look

  • movement is the raw motion since the previous snapshot, locked or not.
  • lock: document locks the pointer on a click. The module requests the lock in its own listener, because browsers only grant it inside a click, and that click is not reported as a press.
  • locked turns false on Escape, which also releases any held buttons.

Timelines record and replay wheel, movement and locked. press/release take PhysicalButtons only, because wheel pulses come from wheel.

Touch (breaking): Touch.track → Touch.actions, Touch.Touch → Touch.Actions, TrackOptions → ActionsOptions. The website demo and the unreleased #62 changeset are updated.

Checks

  • pnpm run check (639 tests)
  • pnpm --dir website typecheck and build (snippets compile)
  • Runtime tests and type tests cover:
    • wheel pulses, small scrolls adding up, a direction change, line/page units;
    • the lock flow: the locking click isn't a press, movement, unlocking releases held buttons, listener cleanup;
    • timeline round-trips;
    • a DOM canvas and document accepted as hosts.

🤖 Generated with Claude Code

… Touch.actions

The wheel reports its scroll (wheel) and pulses wheelUp/Down/Left/Right
buttons once per notch, so stepping actions bind it. movement reports raw
motion, and the lock option locks the pointer on a click (not reported as
a press) with locked turning false on Escape. Timelines record all three.
Touch.track, Touch.Touch, and TrackOptions become Touch.actions,
Touch.Actions, and ActionsOptions, like every other device.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@SandroMaglione
SandroMaglione merged commit b47000c into main Oct 23, 2026
3 checks passed
@SandroMaglione
SandroMaglione deleted the feat/pointer-wheel-lock branch October 23, 2026 02:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant