Improve button behavior when multiple mouse buttons are used at the same time
- To emit `pressed`, buttons require that the press was initiated while hovering. - Controls can't grab focus from a mouse click if they're not hovered. - Hovers are updated both before and after a handled mouse button event.
This commit is contained in:
@ -1768,7 +1768,9 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
|
||||
Control *control = Object::cast_to<Control>(ci);
|
||||
if (control) {
|
||||
if (control->get_focus_mode() != Control::FOCUS_NONE) {
|
||||
if (control != gui.key_focus) {
|
||||
// Grabbing unhovered focus can cause issues when mouse is dragged
|
||||
// with another button held down.
|
||||
if (control != gui.key_focus && gui.mouse_over_hierarchy.has(control)) {
|
||||
control->grab_focus();
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user