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 event coordinate system in Viewport::_sub_windows_forward_input #59118

Merged

Conversation

Sauermann
Copy link
Contributor

@Sauermann Sauermann commented Mar 13, 2022

Previously Viewport::_sub_windows_forward_input did not take into account, that the parent window-viewport could possibly be stretched. This patch changes this so that event coordinates are converted accordingly.

The position of p_event is in the coordinate system of the window/viewport.
The position of ev is in the coordinate system of the window/viewport with applied the final_transform, which is the coordinate system, in which the PopupMenu expects its InputEvents.

This solves problems like this for stretched Window-Viewports and PopupMenu:

BugPopupMenu.mp4

fix #59573
Part of godotengine/godot-proposals#3866

@Sauermann Sauermann requested review from a team as code owners March 13, 2022 17:55
@Sauermann Sauermann marked this pull request as draft March 13, 2022 18:16
@Sauermann Sauermann force-pushed the fix-window-input-event-coordinates branch 2 times, most recently from b92fe26 to eb4f071 Compare March 13, 2022 21:15
@Sauermann Sauermann changed the title Fix coordinate system in Window::window_input event. Fix event coordinate system in Viewport::_sub_windows_forward_input Mar 13, 2022
@Sauermann Sauermann marked this pull request as ready for review March 13, 2022 21:20
@Sauermann Sauermann force-pushed the fix-window-input-event-coordinates branch from eb4f071 to 091206c Compare March 13, 2022 21:25
@Sauermann Sauermann marked this pull request as draft March 14, 2022 06:37
@Sauermann Sauermann marked this pull request as ready for review March 14, 2022 06:58
@akien-mga akien-mga merged commit 7e5cd4b into godotengine:master Mar 28, 2022
@akien-mga
Copy link
Member

Thanks!

@Sauermann Sauermann deleted the fix-window-input-event-coordinates branch March 28, 2022 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OptionButton options not selectable after DisplayServer.window_set_size()
3 participants