소스 검색

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
Patrick Yates 7 년 전
부모
커밋
c433d83d81
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      core/os/input_event.cpp

+ 1 - 1
core/os/input_event.cpp

@@ -637,7 +637,7 @@ bool InputEventJoypadMotion::action_match(const Ref<InputEvent> &p_event) const
 	if (jm.is_null())
 	if (jm.is_null())
 		return false;
 		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 {
 String InputEventJoypadMotion::as_text() const {