system
November 17, 2020, 5:51pm
1
Attention
Topic was automatically imported from the old Question2Answer platform.
Asked By
pferft
Hi everyone,
it appears that mouse_exited isn’t recognized when exiting a Button while holding the mousebutton (or finger on a touchscreen…) pressed. Is there any way to do this?
system
November 17, 2020, 6:13pm
2
Reply From:
jgodfrey
Seems like it’s a known issue. See here:
opened 11:25AM - 10 Aug 18 UTC
closed 12:39AM - 08 Jul 23 UTC
bug
confirmed
topic:input
topic:gui
**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
```
if (gui.mouse_focus) {
over = gui.mouse_focus;
//recompute focus_inv_xform again here
} else {
over = _gui_find_control(mpos);
}
```
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
```
if (over != gui.mouse_over) {
if (gui.mouse_over)
gui.mouse_over->notification(Control::NOTIFICATION_MOUSE_EXIT);
_gui_cancel_tooltip();
if (over)
over->notification(Control::NOTIFICATION_MOUSE_ENTER);
}
```
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:**
1. Connect the "mouse_entered" or "mouse_exited" signal of any control node
2. add another control node, that does not ignore the mouse
3. start your drag on the control element of point 2 and drag over the control element from point 1
4. notice that no "mouse_entered" and no "mouse_exited" signals get fired
There are some suggested work arounds in this thread:
https://forum.godotengine.org/10092/mouse-enter-events-triggering-until-other-input-completed
Thanks (again) Jgodfrey!
I couldn’t manage any such work around yet, tried combinations with Area2Ds (which recognize mouse-exits, only not if they overlap buttons!) and whatnot, so I’ll keep trying. It’s so weird that this happens, I only wonder why? This seems so essential.
pferft | 2020-11-18 15:40