summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Yates <frozen.dinosaur@gmail.com>2017-10-21 16:06:24 +1100
committerPatrick Yates <frozen.dinosaur@gmail.com>2017-10-21 16:06:24 +1100
commitc433d83d810222200410cdddaf0c0326d636e8f4 (patch)
treeb1a2399ca77d6b8bc32d74e4a5847eb266acc560
parent8bc96cc14690d78435d3c2fb960d416df41af790 (diff)
Fix InputEventJoypadMotion::action_match for 0 axis values.
Make action_match ignore the sign if axis value is 0. This means that an axis value of 0 will match actions defined for both positive and negative values, as expected. Fixes #12223
-rw-r--r--core/os/input_event.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/os/input_event.cpp b/core/os/input_event.cpp
index bef98ac3f2..6b43f2c63b 100644
--- a/core/os/input_event.cpp
+++ b/core/os/input_event.cpp
@@ -637,7 +637,7 @@ bool InputEventJoypadMotion::action_match(const Ref<InputEvent> &p_event) const
if (jm.is_null())
return false;
- return (axis == jm->axis && (axis_value < 0) == (jm->axis_value < 0));
+ return (axis == jm->axis && ((axis_value < 0) == (jm->axis_value < 0) || jm->axis_value == 0));
}
String InputEventJoypadMotion::as_text() const {