Repository navigation
Don't fire clicks after third-person camera rotation or walking - #941
Merged
Merged
Conversation
foxtacles
enabled auto-merge (squash)
November 23, 2026 04:07
Holding the right mouse button to rotate the third-person camera and clicking the left button during it fired the left click once both buttons were released. The camera's filter only dropped mouse events while the right button was held alone, so the left press got through and the right button's release completed the click. The filter now drops every mouse event while the right button is held and cancels the pending click. Releasing the left button after holding it to walk also fired a click where it was pressed. The third-person camera now cancels the pending click once the hold turns into walking. The one-second auto-drag timer never fired since the move to SDL timers, because its callback built the timer event without pushing it, so holding the mouse still always ended in a click. The event is pushed again and compared by the 8 bits of the timer ID that the notification carries, since SDL timer IDs grow past 255, and the camera's filter leaves timer events alone. As in the original game, holding the mouse still for a second starts mouse navigation instead of clicking.
foxtacles
force-pushed
the
fix/tp-camera-rmb-click
branch
from
November 23, 2026 05:04
cb76c4c to
fa92f29
Compare
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.
In third-person mode, holding the right mouse button to rotate the camera and clicking the left button during it fired the left click once both buttons were released. Releasing the left button after holding it to walk also fired a click where it was pressed.
The camera's filter in
LegoInputManager::ProcessOneEventonly dropped mouse events while the right button was held alone. The left press during a rotation got through and armed a click, the left release was dropped, and the right button's release then completed the click at the spot of the left press. This happened in every order of presses and releases, including holding the left button to walk and adding the right button to steer. The left press also reached the world's own button handlers during the rotation, which, for example, reset the pizza mission during its introduction. The filter now drops every mouse event while the right button is held and cancels the pending click.For walking, the third-person camera now cancels the pending click once a left button hold turns into walking, also after zooming into first person while still holding the button.
Holding the mouse still is also supposed to end in a drag rather than a click: the original game starts mouse navigation after one second. The timer for this never fired since the move to SDL timers, because its callback built the timer event without pushing it. The event is pushed again and compared by the 8 bits of the timer ID that the notification carries, since SDL timer IDs grow past 255, and the camera's filter leaves timer events alone.
Tested on macOS with scripted mouse, wheel and touch input in a native build, and in the web build in headless Chrome with real mouse input, comparing the old and new behavior in each scenario:
🤖 Generated with Claude Code
https://claude.ai/code/session_0179vyTGZwyMZgoazji12e2B