Update focus mask only if there is a focused control, fixes #26524

This commit is contained in:
Juan Linietsky 2019-03-04 10:26:48 -03:00
parent 9dd9737cb4
commit 03cafd4895

View file

@ -1783,13 +1783,15 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
*/ */
gui.mouse_focus = _gui_find_control(pos); gui.mouse_focus = _gui_find_control(pos);
gui.mouse_focus_mask = 1 << (mb->get_button_index() - 1);
gui.last_mouse_focus = gui.mouse_focus; gui.last_mouse_focus = gui.mouse_focus;
if (!gui.mouse_focus) { if (!gui.mouse_focus) {
gui.mouse_focus_mask = 0;
return; return;
} }
gui.mouse_focus_mask = 1 << (mb->get_button_index() - 1);
if (mb->get_button_index() == BUTTON_LEFT) { if (mb->get_button_index() == BUTTON_LEFT) {
gui.drag_accum = Vector2(); gui.drag_accum = Vector2();
gui.drag_attempted = false; gui.drag_attempted = false;