From 8c9d7bc5670a0ae8ad05851728bf254683ae43ae Mon Sep 17 00:00:00 2001 From: Relintai Date: Mon, 16 Jan 2023 14:46:29 +0100 Subject: [PATCH] Ported: Set touch input as handled only after _gui_call_input - necrashter https://github.com/godotengine/godot/commit/147de75e521ed5a075a04bd3ae75e6b5156ddb29 --- scene/main/viewport.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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; } }