Skip to content

Viewer: keep Alt and Meta shortcuts from moving the camera - #7632

Open
airp1ane wants to merge 1 commit into
ItsNotRexed:mainfrom
airp1ane:viewer-modified-movement
Open

airp1ane wants to merge 1 commit into
ItsNotRexed:mainfrom
airp1ane:viewer-modified-movement

Conversation

@airp1ane

Copy link
Copy Markdown
Contributor

Coordination claim

The viewer records movement keys before checking shortcut modifiers, so Meta+W and Alt+W can move the camera. Ignore Alt and Meta keydowns before recording movement. Ctrl slow movement remains available.

  • Focused browser shortcut test on Windows with Node.js 26.13.1 failed before the fix and passed after.
  • Full viewer suite (node --test tests/test_viewer_streaming.cjs): 56 passed, one failed. The existing camera-speed test lacks AbortController and also failed before the fix.
  • python -I scripts/check_no_game_data.py viewer/index.html tests/test_viewer_streaming.cjs passed with Python 3.15.2.
  • git diff --check passed.

Depends on: #7085 for the existing camera-speed fixture failure.

AI-assisted (Codex). CPU-only tests with synthetic inputs.

@kapitche

Copy link
Copy Markdown
Contributor

Tested db4baf6 merged with main 603d53e on Linux/Python 3.12.16 (node v22.23.5 for the .cjs test): pass

  • node tests/test_viewer_streaming.cjs with the PR merged: 57 tests, 56 pass, 1 fail. The one failure is "Shift speeds the camera up and Ctrl slows it down, on either side of the keyboard" (ReferenceError: AbortController is not defined inside the test's vm context). It fails identically on plain main (56 pass, 1 fail), so it is not caused by this PR.
  • The new assertion is in "browser shortcuts leave viewer actions alone and Ctrl movement remains available", which passes with the PR.
  • Negative control: viewer/index.html restored from upstream/main with the PR's test kept: that test fails (metaKey), 55 pass / 2 fail. Restored the PR version afterwards.
  • Diff read: the early return for metaKey/altKey now runs before keys.add, so those keys are never recorded as held; Ctrl still adds the key and only skips the F/T/G shortcuts.

@whattheflop

Copy link
Copy Markdown
Contributor

AI-assisted T3 Preview integration check. #4763 at 67b006fe, #7085 at e9421daa and this head db4baf60 merged cleanly (tree 5a3fcff2). The streaming, Assets and Studio Node suites went from 75/76 (the known AbortController fixture failure on #4763 alone) to 76/76 together with Node 24.16.0 on Windows.

In the real viewer on a synthetic manifest with local Three.js r160, keyboard-event dispatch and one controlled 20 ms render tick moved the camera 0.8 m for Alt+W and Meta+W on the base, and 0 m on the combination. Plain W, Ctrl+W and right Shift+W were identical on both (0.8 m, 0.16 m, 4.0 m). Key release stopped motion in all ten cases. The scratch probe supplied deterministic ticks and used the viewer's existing handlers and movement code. It did not trigger OS browser shortcuts. No game data.

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.

3 participants