From c7809991b23cd3a0908abd025e755e80ca094a18 Mon Sep 17 00:00:00 2001 From: Relintai Date: Mon, 12 Dec 2022 18:30:35 +0100 Subject: [PATCH] Fixed an another issue with touch gui input handling. --- scene/main/viewport.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 9142c5ef1..052920378 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -2217,14 +2217,15 @@ void Viewport::_gui_input_event(Ref p_event) { if (touch_event->is_pressed()) { Control *over = _gui_find_control(pos); if (over) { - gui.touch_focus[touch_index] = over->get_instance_id(); if (!gui.modal_stack.empty()) { Control *top = gui.modal_stack.back()->get(); if (over != top && !top->is_a_parent_of(over)) { return; } } + if (over->can_process()) { + gui.touch_focus[touch_index] = over->get_instance_id(); touch_event = touch_event->xformed_by(Transform2D()); //make a copy if (over == gui.mouse_focus) { pos = gui.focus_inv_xform.xform(pos); @@ -2234,12 +2235,14 @@ void Viewport::_gui_input_event(Ref p_event) { touch_event->set_position(pos); _gui_call_input(over, touch_event); } + 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) {