-
-
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
"mouse_entered" and "mouse_exited" signals are broken while holding down a mouse button #20881
Comments
Confirmed on my master build too. Note: if you set mouse filter to "ignore" on the parent control the color rectangle signals works as expected. |
linked to #23296 |
Note from #32727, this does also happen for is_hovered() |
This comment has been minimized.
This comment has been minimized.
Still an issue in Godot 3.2.2beta ed27b7e |
Still in 3.2.4RC2. |
managed to get around this by making my own _input(event:InputEventMouseButton) function.
I then reset the mouse_filter to ..._PASS on the mouse release. |
Can not get this to work. The line |
get_global_rect().has_point(get_local_mouse_position()) |
Both EDIT: var rect_check = Rect2(Vector2(0,0), node.get_global_rect().size)
var local_mouse_pos = node.get_local_mouse_position()
if rect_check.has_point(local_mouse_pos):
inside = true
|
@Banderi |
Wasted hours thinking it was my code :-( v3.3.1 |
This is probably related to a common UI behavior, which I saw called "mouse capture" on Windows. The idea is to make it easier to implement exclusive dragging logic, by making the control receive mouse events and appear pressed as long as the mouse was pressed inside and remains pressed even if it exits the area of the control. I would not be surprised if this wasnt documented because it's a subtle behavior happening with many widgets, and has no associated option. For example, take a scrollbar. Press it, keep the mouse held, and move away from it. It will remain pressed, and will still respond to your movements, while every other control will ignore the mouse. You can reproduce this behavior on non-Godot UIs as well, even sometimes on controls that are not usually draggable (see how some buttons remain pressed when you do this too). Things can differ a bit though, because there are many UI systems around. Sometimes hover effects don't follow this, while pressed effects do. Godot happens to do both, including enter/exit. About |
Thanks for that, makes sense. If this is the case then I would def upvote an option to switch it off for certain scenarios. |
Out of curiosity, does this behavior happen with CollisionObject2D/3D's
Feel free to open a pull request to do this 🙂 The property should be added to Control and the default behavior should be kept as it is now. |
I mean exactly what I mean - the interpretation of the cursor behavior within the godot's engine logic has nothing to do with the interpretation and behavior of the mouse anywhere, even in Windows, even in Linux, even on an alien spaceship. |
@MadDogMayCry0 |
@MadDogMayCry0 even though it works, what you do with |
Of course, you must adapt my logic to what you are trying to do with your code. My logic only explains and demonstrates how to fix this bug. However, it can be applied to anything, both modals and dialogs and absolutely any situation in general. |
@MadDogMayCry0 it seems to me that we don't understand each other. |
If you look at the code further than that piece you refer to all the time, you will probably see that there is a fork from the native functions and of course all the approaches you listed like drag and drop and other nonsense you need to add yourself. This works for about 10 minutes of time. I have not argued or asserted that my approach is universal, I will repeat myself once again - this is a demonstration of solving a problem, a demonstration that allows you to bypass native logic and build your own. |
any movement on this issue? better yet could we have some access to some sort of function that could just query the screen at a certain position.... then people who rely on this unexpected behaviour wouldn't be affected as it stands you need to come up with your own BSP/ReportingGrid... check every control over and over each frame etc... surely i cannot be the only person that wants to drag one control to another and detect i'm hovering over a different control.... if you reproduce windows you need to drag items to the recycle bin... if you create a drag drop equiping screen you need to drag inventory items to other ones this limitation is highly impractical for what to me seems a common thing in video game UIs |
see my 2 pull requests #54565 and #54552 and also #67791 from @Sauermann |
Can confirm this problem in 3.5.2 Stable |
Can't reproduce in 4.1. |
Tested in v4.2.dev.custom_build [c3b0a92]. However, when starting Control and hovering Control are in different Viewports (SubViewport or Window), then I can reproduce the problem in many cases. |
Closing then. The more complex case is a separate issue. |
I didn't test it, but It is likely that this got fixed by #59555. |
Experiencing this on Godot 3.5.2 I am using using this to feature for drag & dropping items in my inventory system. Move move over item slot -> Triggers MOUSE ENTERED (Good)
|
The issue is only fixed in Godot 4.1. |
Does anyone know if it will be fixed in 3.5.x ? |
Just hit this issue. Doesn't look fixed in 3.5.3 stable. Bummer. |
Can confirm this bug is still not fixed in 3.5.3 stable. |
Godot version:
fbb5ca4
OS/device including version:
Linux Manjaro
Issue description:
The "mouse_entered" and "mouse_exited" signals of control nodes don't get fired while holding any mouse button down when the click (any mouse button down) started on a control that does not ignore the mouse.
it's actually because in viewport.cpp in line 1843 to 1850 "over" get's set to the mouse_focus
and shortly after ( line 1884 to 1893 ) the mouse_exited and mouse_entered signals get not fired because the gui.mouse_focus and the gui.mouse_over are the same
This may be a desired behavior, for a lot of cases.
But there are also cases where it is very useful to send those signals. (I'll update this post soon to show such a case)
Steps to reproduce:
The text was updated successfully, but these errors were encountered: