-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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 SubViewportContainer processing Events before other Control-Nodes #58334
Fix SubViewportContainer processing Events before other Control-Nodes #58334
Conversation
Thanks for your review. The following perspective may give a different view on the perceived weirdness: In your suggested order, the combination "R(gui) -> ... -> G(unhandled)" is the reason for issue #17326, because right after "SubViewportContainer(gui)" the event gets set to handled. This makes the sequence "G(gui) -> G(unhandled) -> ... -> R(gui)" necessary. |
2a78969
to
fc6d205
Compare
fc6d205
to
c1c64d0
Compare
e3fc58e
to
d186767
Compare
Change SubViewportContainer, so that it processes events with a position property no longer in 'input', but in 'gui_input'. This fixes the issue, that Nodes within its SubViewport receive MouseButton events before other Control-Nodes.
d186767
to
56ddf89
Compare
Together with #57894, this PR fixes several outstanding problems about @KoBeWi some time ago you asked for a project file for these problems, but I only had a very complicated one available. I believe, that this should make the review-process simpler. |
With the goal of a better understanding of the changes from my PRs I have created a documentation graphic for event processing including changes from #57894. For comparison, here is a graphic of the previous event processing order: |
This took a while to understand properly because there is just so much to consider, but at this point I agree it's the best possible way to do it. |
Thanks! |
Currently,
SubViewportContainer
propagates all its events in_input
1 before all other
Control
-Nodes (fix #39666)2 and where
rect_position
andrect_size
of aControl
-Node do not matter (fix #28833)fix one of the reasons for #58902
alternative to #55300
MRP for all related Bugs: SubViewportEventBugs.zip
This patch changes
SubViewportContainer
, so that it propagates positional events (events that have a position property) no longer in_input
, but in_gui_input
to itsSubVieworts
viapush_input
.Event coordinates
Since
_input
and_gui_input
expect different event-position-coordinate-systems, they now have to be adjusted only with the shrink factor in_gui_input
.Changes to Events
Here is a description of how this patch affects events.
position
The
position
of the event (like a mouse-click) specifies theControl
-Node, they are intended for. Just like in master, these events get delivered to theControl
-Node, that is located at theposition
. They are no longer delivered automatically toSubViewports
of otherSubViewportContainer
, that are away from the position. The following graphic shows how event propagation of positional events (green line) changes.position
Those events get sent to the same nodes in the same order as in the current master.
Additional thoughts
Update 2022-09-29: Evaluate positional Events explicitely
Update 2022-10-02: Fix coordinate transform in _gui_input