mirror of
https://github.com/godotengine/godot
synced 2024-09-05 15:39:52 +00:00
Merge pull request #93011 from MTareqAzim/fix-android-motion-event-guards
Fix Left Joystick Motion Not Registering on Android
This commit is contained in:
commit
e78db2c423
|
@ -228,16 +228,6 @@ public class GodotInputHandler implements InputManager.InputDeviceListener {
|
||||||
public boolean onGenericMotionEvent(MotionEvent event) {
|
public boolean onGenericMotionEvent(MotionEvent event) {
|
||||||
lastSeenToolType = getEventToolType(event);
|
lastSeenToolType = getEventToolType(event);
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && gestureDetector.onGenericMotionEvent(event)) {
|
|
||||||
// The gesture detector has handled the event.
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (godotGestureHandler.onMotionEvent(event)) {
|
|
||||||
// The gesture handler has handled the event.
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event.isFromSource(InputDevice.SOURCE_JOYSTICK) && event.getActionMasked() == MotionEvent.ACTION_MOVE) {
|
if (event.isFromSource(InputDevice.SOURCE_JOYSTICK) && event.getActionMasked() == MotionEvent.ACTION_MOVE) {
|
||||||
// Check if the device exists
|
// Check if the device exists
|
||||||
final int deviceId = event.getDeviceId();
|
final int deviceId = event.getDeviceId();
|
||||||
|
@ -273,11 +263,20 @@ public class GodotInputHandler implements InputManager.InputDeviceListener {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
return false;
|
||||||
return handleMouseEvent(event);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && gestureDetector.onGenericMotionEvent(event)) {
|
||||||
|
// The gesture detector has handled the event.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (godotGestureHandler.onMotionEvent(event)) {
|
||||||
|
// The gesture handler has handled the event.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return handleMouseEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initInputDevices() {
|
public void initInputDevices() {
|
||||||
|
|
Loading…
Reference in a new issue