From 672fe2487f884729ca0da4018c51ce3f0ab6c3c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Thu, 27 Feb 2025 17:25:34 +0100 Subject: [PATCH] Input: Change default deadzone back to 0.5 for `ui_*` actions and axis `pressed` state Fixes #103360. Partial revert of changes in #97281 and #99135. --- core/config/project_settings.cpp | 2 +- core/input/input_event.cpp | 2 +- core/input/input_map.h | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp index a6725ce38bd..e4cc0f9c03b 100644 --- a/core/config/project_settings.cpp +++ b/core/config/project_settings.cpp @@ -1439,7 +1439,7 @@ void ProjectSettings::_add_builtin_input_map() { } Dictionary action; - action["deadzone"] = Variant(InputMap::DEFAULT_DEADZONE); + action["deadzone"] = Variant(InputMap::DEFAULT_TOGGLE_DEADZONE); action["events"] = events; String action_name = "input/" + E.key; diff --git a/core/input/input_event.cpp b/core/input/input_event.cpp index bd793ef6b8f..6e8cdc4b8e4 100644 --- a/core/input/input_event.cpp +++ b/core/input/input_event.cpp @@ -1104,7 +1104,7 @@ JoyAxis InputEventJoypadMotion::get_axis() const { void InputEventJoypadMotion::set_axis_value(float p_value) { axis_value = p_value; - pressed = Math::abs(axis_value) >= InputMap::DEFAULT_DEADZONE; + pressed = Math::abs(axis_value) >= InputMap::DEFAULT_TOGGLE_DEADZONE; emit_changed(); } diff --git a/core/input/input_map.h b/core/input/input_map.h index 0479d45c57b..520c10c46e0 100644 --- a/core/input/input_map.h +++ b/core/input/input_map.h @@ -55,6 +55,8 @@ public: }; static constexpr float DEFAULT_DEADZONE = 0.2f; + // Keep bigger deadzone for toggle actions (default `ui_*` actions, axis `pressed`) (GH-103360). + static constexpr float DEFAULT_TOGGLE_DEADZONE = 0.5f; private: static InputMap *singleton;