-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
MouseEnter/Exit events not correctly passed on from children to parent script since Godot 4.2 dev3 #81909
Comments
If I understand it correctly, then you want to have the ability, that the mouse should be considered simultaneously over multiple different Controls? This behavior previously led to several problematic situations, where for example some mouse-exited signals were not sent in edge-cases. A different effect, that the previous behavior had, was that in the following variation of your MRP the mouse could be considered over The behavior got changed in #67791 which was the attempt to solve these issues. Now there is only a single Control, that the mouse can be over at all times.
I have tested in v4.2.dev.custom_build [571cd0e] that custom tooltips (via In order to solve your use-case, of knowing if the mouse is somewhere within the rectangle of
|
I agree that mouse events have been weird for a little while for me as well, and from what I understand of @Sauermann's reply, I now absolutely do not understand why In the example, yes, having the mouse being over the parent on a child that isn't in it's bounding box is weird, but I feel like bubbling up like that is exactly what |
Oh I didn't even know "custom tooltips" were a high level concept in Godot 😀 What I meant was completely handling the tooltip logic yourself (via the Here is a concrete example from our game where this issue became a problem after the update to 4.2 dev4: With the update to 4.2 dev4 the tooltip now only gets shown when I hover over the small margin where the Here is the mouse_filter documentation for
So the behavior before 4.2 dev3 was more or less exactly what was described there. The way it is now, that description is no longer correct. I would even say that the description for
|
If you don't need to handle input events in the children nodes, then this is in my opinion the best approach for your use-case. This has also a performance benefit, since these nodes simply ignore mouse events. I didn't mention this approach as a possible solution to your situation in my previous post, because I did assume, that these Control nodes process mouse events.
I agree, that the documentation needs to be improved. |
For more complex UIs, using mouse filter ignore wont work and the workarounds become more lengthy. We could instead have multiple signals like mouse enter / exit and mouse over / out (or hover enter / exit).
The current implementation is great for stuff like scene picking, so both are useful. |
Tested #84547, I confirm that it fixes the MRP in the OP. |
Thanks for testing! I also tried #84547 with our game and it definitely closes this issue 👍 |
Godot version
4.2 dev3 and 4.2 dev4
System information
Windows 10
Issue description
With the following Control Node hierarchy:
the
TextureRect
Node (godot icon) blocks themouse_entered / mouse_exited
signals in the script of theParentWithScript
Node (the white area). TheTextureRect
uses its defaultmouse_filter
ofPass
. When using themouse_filter
Ignore
, the signals are triggered correctly on the parent.I went back the official versions to see when the behavior started and it seems to have started with 4.2 dev3.
In 4.2 dev2 the behavior is still a bit weird, but it has been like that for a long time (tested with 4.1.1) : when moving the mouse from "over the parent" (the white area in the MRP) directly to "over the child" (the godot icon), the
mouse_exited
signal gets triggered first and then directly themouse_entered
again. But at least the last signal that gets triggered ismouse_entered
(important for custom tooltips!).Another quick observation (that is not in the MRP): I added a tooltip to the
ParentWithScript
node and that gets correctly shown when hovering over theTextureRect
child node! So it seems to only affect the signals.Steps to reproduce
entered
gets printed when hovering over the white area (the parent), butexited
gets called as soon as the mouse moves over the godot icon (the child)Minimal reproduction project
MouseEnterExitTest.zip
The text was updated successfully, but these errors were encountered: