From 250749fa7956b450fff8446d5f361874743389ca Mon Sep 17 00:00:00 2001 From: Fredia Huya-Kouadio Date: Wed, 3 May 2023 17:57:13 -0700 Subject: Augment the `InputEvent` class with a `CANCELED` state The `InputEvent` class currently supports the `pressed` and `released` states, which given the binary nature, is represented by a `bool` field. This commit introduced the `CANCELED` state, which signals that an ongoing input event has been canceled. To represent all the states, the `InputEventState` enum is added and the `InputEvent` logic is refactored accordingly. --- core/input/input.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'core/input/input.cpp') diff --git a/core/input/input.cpp b/core/input/input.cpp index 5aef9a9039..15d894bd8b 100644 --- a/core/input/input.cpp +++ b/core/input/input.cpp @@ -542,6 +542,7 @@ void Input::_parse_input_event_impl(const Ref &p_event, bool p_is_em Ref touch_event; touch_event.instantiate(); touch_event->set_pressed(mb->is_pressed()); + touch_event->set_canceled(mb->is_canceled()); touch_event->set_position(mb->get_position()); touch_event->set_double_tap(mb->is_double_click()); touch_event->set_device(InputEvent::DEVICE_ID_EMULATION); @@ -613,6 +614,7 @@ void Input::_parse_input_event_impl(const Ref &p_event, bool p_is_em button_event->set_position(st->get_position()); button_event->set_global_position(st->get_position()); button_event->set_pressed(st->is_pressed()); + button_event->set_canceled(st->is_canceled()); button_event->set_button_index(MouseButton::LEFT); button_event->set_double_click(st->is_double_tap()); -- cgit v1.2.3