Skip to content

Hold the view still when a click gives the mouse back (send home jump) - #191

Merged
webdevcody merged 1 commit into
mainfrom
office/nibble-67ca
Sep 30, 2026
Merged

webdevcody merged 1 commit into
mainfrom
office/nibble-67ca

Conversation

@webdevcody

Copy link
Copy Markdown
Contributor

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 asks player.lock(settle).
  • A settling lock (player.ts) is still taken at once, as CLAUDE.md requires 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.
  • Closing with a key (Esc, Enter on the focused button) and clicking the office to take the mouse behave exactly as before: the view turns straight away.

Verification

  • npm run typecheck, npm run build and npm test (411 pass).
  • Headless Chrome (Metal) smoke against a real office, with shell/agent workers at desks, with and without worktrees. Same script against unmodified HEAD and this branch:
check HEAD this PR
Click Send home, hand keeps moving: view stays put ❌ swings ✅
…mouse-look is back at once ✅ ✅
…after a rest, the mouse looks around again ✅ ✅
Hand keeps moving 1.5 s: turns again after the 1 s cap ✅ ✅
Click ✕, hand keeps moving: view stays put, mouse-look back at once ❌ swings ✅
Enter / Esc: looks around straight away ✅ ✅
Click on the office to take the mouse: looks around straight away ✅ ✅

🤖 Generated with Claude Code

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>
@webdevcody
webdevcody merged commit 71f1971 into main Sep 30, 2026
1 check passed
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