-
-
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
is_hovered() is tied to button focus and not the actual cursor position #29326
Comments
Looks fixed to me in Godot 3.2.3 rc2, but maybe I'm testing wrongly. @MAVREE Can you confirm? |
Downloaded 3.2.3 rc2, it could be I'm doing what i would like to do wrong but print logs now tell me that the mouse is not hovering the button it is actually hovering if i previously navigate with the arrow keys. Also it still thinks the button is hovered with is_hovered() if it gets focused by navigating with the keyboard buttons while the mouse is not there. Sorry if I'm not describing it well, I'm posting another gif with a (probably) better visualization of what is happening, I only edited the print line to make it more descriptive (reuploading the zip of the project updated to 3.2.3 rc2) |
I found the code responsible for this problem: godot/scene/gui/base_button.cpp Lines 98 to 101 in ec678c5
Looks like in Button "hovered" basically means "focused". The easiest way to fix this would be renaming all current instances of "hover" into "focus" and then introduce a proper |
There's |
This can already be easily done with script, using |
This bug is creating problem in my game. What changes can i do in godot 3.2.2 code to solve this is_hovered() problem. |
You can connect the Button's |
Same Problem is coming in mouse_entered and mouse_exited signals as mentioned in bug #47433. |
Seems like mouse_exited does not get called if you are pressing the button, dragging outside the button while still holding. |
I don't think the issue got resolved in mobile devices. I am still getting the same issue in Android. |
Did you compile the latest |
i have added these changes in godot-3.3.2 and then compiled. Issue reproduction - |
Godot version: 3.1.1 stable
OS/device including version: Windows 10
Issue description: Trying to check if a non-focused button is hovered with is_hovered() (while another one is focused) will return false even if the mouse is actually hovering it. Meanwhile if the focus is on that button and the mouse is off the button bounds it still returns true.
(I'm trying to make mouse and keyboard/gamepad live and work together by swapping "states")
Minimal reproduction project: Attached a simple 3.1.1 project with some buttons and the same functions i used to reproduce the problem, pressing E the function prints the return of is_hovered(). Also a gif showing the problem
TestBugHover.zip
The text was updated successfully, but these errors were encountered: