Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Viewport::get_mouse_position for SubViewports #71768

Merged
merged 1 commit into from
Feb 7, 2023

Conversation

Sauermann
Copy link
Contributor

@Sauermann Sauermann commented Jan 20, 2023

SubViewports don't have a cached mouse position available. This PR calculates the mouse position from the screen position of the mouse cursor.

Closes #60390
Closes #72807
supersedes #62274

The get_screen_transform API-change doesn't break compatibility, because the behavior with the default-value stays the same.

Updated 2023-01-27: Fix merge conflict
Updated 2023-01-31: Rebase to master after #71972 which made necessary changes to unittests.
Updated 2023-02-01: Fix merge conflict
Updated 2023-02-03: Fix merge conflict

@RandomShaper
Copy link
Member

Is there any potential use case for the exposed p_absolute_position? If it's only for engine internal usage, maybe it could be removed from the exposed API and an internal function created which takes it.

Just to be sure, since I'm a bit fuzzy on the details now.

@Sauermann
Copy link
Contributor Author

You are right. Currently I can't think of any use-case for p_absolute_position == true. Will update the PR and make absolute accessible only internally.

SubViewports don't have a cached mouse position available.
This PR calculates the mouse position from the screen position of
the mouse cursor.
@akien-mga akien-mga merged commit 7ebd8b5 into godotengine:master Feb 7, 2023
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants