Преглед изворни кода

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.
Rémi Verschelde пре 5 месеци
родитељ
комит
672fe2487f
3 измењених фајлова са 4 додато и 2 уклоњено
  1. 1 1
      core/config/project_settings.cpp
  2. 1 1
      core/input/input_event.cpp
  3. 2 0
      core/input/input_map.h

+ 1 - 1
core/config/project_settings.cpp

@@ -1439,7 +1439,7 @@ void ProjectSettings::_add_builtin_input_map() {
 			}
 			}
 
 
 			Dictionary action;
 			Dictionary action;
-			action["deadzone"] = Variant(InputMap::DEFAULT_DEADZONE);
+			action["deadzone"] = Variant(InputMap::DEFAULT_TOGGLE_DEADZONE);
 			action["events"] = events;
 			action["events"] = events;
 
 
 			String action_name = "input/" + E.key;
 			String action_name = "input/" + E.key;

+ 1 - 1
core/input/input_event.cpp

@@ -1104,7 +1104,7 @@ JoyAxis InputEventJoypadMotion::get_axis() const {
 
 
 void InputEventJoypadMotion::set_axis_value(float p_value) {
 void InputEventJoypadMotion::set_axis_value(float p_value) {
 	axis_value = 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();
 	emit_changed();
 }
 }
 
 

+ 2 - 0
core/input/input_map.h

@@ -55,6 +55,8 @@ public:
 	};
 	};
 
 
 	static constexpr float DEFAULT_DEADZONE = 0.2f;
 	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:
 private:
 	static InputMap *singleton;
 	static InputMap *singleton;