Fix #3133: Right mouse drag no longer works on main viewport#3134
Merged
duncanspumpkin merged 5 commits intoOpenLoco:masterfrom Jul 3, 2025
Merged
Fix #3133: Right mouse drag no longer works on main viewport#3134duncanspumpkin merged 5 commits intoOpenLoco:masterfrom
duncanspumpkin merged 5 commits intoOpenLoco:masterfrom
Conversation
I'm realising viewportIsFocusedOnEntity was bending the idea of "functions should do one and only one thing", since "Is there no targeted entity?" is a distinct question from "Is my specific entity being target?" I think. Having the function being able to return true when there is no viewport/saved view feels like the sort of thing that could potentially break an assumption somewhere, or otherwise be confusing
code style sort of change to make it read very slightly easier
ZehMatt
approved these changes
Jul 1, 2025
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.
I believe the problem was #3122's changes. It changes the behaviour of Window::viewportIsFocusedOnEntity with the intention of allowing passing it a targetEntity value of EntityId::null to check if no entity is being focused. This however does not work: it seems that Window::viewportIsFocusedOnEntity always returns false when used in the main viewport window because its savedView always isEmpty (in this situation, at least).
This pull fixes #3133 by reverting #3122's changes to that function, and instead adding a new function for the purpose of checking if there is no entity being targeted.