diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 8f3734f36..2c3da0ff2 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -2234,15 +2234,15 @@ void Viewport::_gui_input_event(Ref p_event) { } touch_event->set_position(pos); _gui_call_input(over, touch_event); + set_input_as_handled(); } - set_input_as_handled(); return; } } else { ObjectID control_id = gui.touch_focus[touch_index]; Control *over = Object::cast_to(ObjectDB::get_instance(control_id)); - + if (over && over->can_process()) { touch_event = touch_event->xformed_by(Transform2D()); //make a copy if (over == gui.last_mouse_focus) { @@ -2254,9 +2254,10 @@ void Viewport::_gui_input_event(Ref p_event) { _gui_call_input(over, touch_event); set_input_as_handled(); - gui.touch_focus.erase(touch_index); - return; } + + gui.touch_focus.erase(touch_index); + return; } }