Hold the view still when a click gives the mouse back (send home jump) - #191
Merged
Merged
Conversation
Sending a worker home ends on a click on Send home. Closing the window takes the mouse straight back for looking around, at the moment the hand that clicked is often already moving on, so the pointer vanished under it and the rest of the move swung the camera somewhere else. A window closed with the mouse (Send home, ✕, the backdrop) still takes it back at once, as closing by ✕ or Esc must, but the view now holds still until the mouse has rested for 250 ms since it was taken (1 s at most). Closing with a key (Esc, Enter) and clicking the office to look around turn the view straight away as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Problem
Sending a worker home in first person: press X at the desk, click Send home. The dialog closes and the office takes the mouse straight back for looking around. It does that at the moment the hand that clicked is usually already moving on. The pointer vanishes under it ("locks up"), and the rest of the move turns into a swing of the camera, so the view jumps somewhere else.
Nothing in the send-home path moves the camera itself. In a headless Chrome smoke, the view turned only by the mouse deltas that arrived after the relock. It's the follow-through of the click. The same thing happens when you close any window by clicking ✕.
Fix
backToGame(main.ts) notes whether the window was closed with the mouse (the last press was a pointer, not a key) and asksplayer.lock(settle).CLAUDE.mdrequires for ✕ and Esc. But the view ignores mouse movement until the mouse has rested for 250 ms since the lock landed, 1 s at most. The pause you make to click doesn't count as resting.Verification
npm run typecheck,npm run buildandnpm test(411 pass).HEADand this branch:🤖 Generated with Claude Code