feat(input): hold keys and buttons to repeat - #94
Merged
Merged
Conversation
…fecycle Pressing a shortcut key or on-screen control button now starts an interaction like a pointer down: the pin shows and the view stays in low-res preview. The action repeats while held (after 400ms, every 50ms) on our own timer rather than the OS key auto-repeat, and the interaction finishes (new reference or full-res render) once every pointer, key and button is released. Held controls live in state.held, and isInteracting() replaces the pointer-only checks. Releases are matched by physical key so Shift changes can't leave a key stuck, and everything is released if the window loses focus.
|
Visit the preview URL for this PR (updated for commit e2099c7): https://fractious-deep--pr94-feat-hold-to-repeat-zjo3wzsu.web.app (expires Fri, 02 Oct 2026 09:59:08 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 348393a9746312ebab7a45ce5eba16e6d119af34 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Holding a key or on-screen button now repeats its action, and keys and buttons share one interaction lifecycle with pointers.
Behaviour
HOLD_DELAY_MS/HOLD_REPEAT_MS). Keys use this timer rather than the OS auto-repeat, so keys and buttons feel the same.?don't.Details
state.heldtracks held keys and buttons.isInteracting(state)(pointers or held) replaces the pointer-only checks inFractious,Rendererand the auto-reload busy check.e.code, so a Shift change between press and release can't leave a key stuck. Windowblurreleases everything.Checks: format, eslint, clippy, WGSL lint, depcruise, wasm + vitest tests (new hold tests) and size budgets pass (main JS 13.86 kB). Not verified here with real touch or mouse input: please try it on the preview, especially long-press on mobile and the repeat speed.