diff options
author | Fredia Huya-Kouadio <fhuyakou@gmail.com> | 2024-07-17 02:44:17 -0700 |
---|---|---|
committer | Fredia Huya-Kouadio <fhuyakou@gmail.com> | 2024-07-17 02:44:17 -0700 |
commit | 53a752f2d62c97ca020741db23ee1ed9f9b7760b (patch) | |
tree | 2b01554c3456548a2c65df756289df5860357904 /platform/android/java/lib | |
parent | 8f7dc862238235d7df26958ddfb2450e68984af1 (diff) | |
download | redot-engine-53a752f2d62c97ca020741db23ee1ed9f9b7760b.tar.gz |
Disable long press for mouse events
Long press is used to simulate right-click events for finger touch and stylus. The previous logic also caused it to trigger for mouse input, which is not needed since the user can instead use the mouse right click button.
This update disables long press as right click events for mouse input.
Diffstat (limited to 'platform/android/java/lib')
-rw-r--r-- | platform/android/java/lib/src/org/godotengine/godot/input/GodotGestureHandler.kt | 5 | ||||
-rw-r--r-- | platform/android/java/lib/src/org/godotengine/godot/input/GodotInputHandler.java | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/platform/android/java/lib/src/org/godotengine/godot/input/GodotGestureHandler.kt b/platform/android/java/lib/src/org/godotengine/godot/input/GodotGestureHandler.kt index 4cd3bd8db9..2929a0a0b0 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/input/GodotGestureHandler.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/input/GodotGestureHandler.kt @@ -76,7 +76,10 @@ internal class GodotGestureHandler(private val inputHandler: GodotInputHandler) } override fun onLongPress(event: MotionEvent) { - contextClickRouter(event) + val toolType = GodotInputHandler.getEventToolType(event) + if (toolType != MotionEvent.TOOL_TYPE_MOUSE) { + contextClickRouter(event) + } } private fun contextClickRouter(event: MotionEvent) { diff --git a/platform/android/java/lib/src/org/godotengine/godot/input/GodotInputHandler.java b/platform/android/java/lib/src/org/godotengine/godot/input/GodotInputHandler.java index 889618914d..96f291c46e 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/input/GodotInputHandler.java +++ b/platform/android/java/lib/src/org/godotengine/godot/input/GodotInputHandler.java @@ -472,7 +472,7 @@ public class GodotInputHandler implements InputManager.InputDeviceListener { return button; } - private static int getEventToolType(MotionEvent event) { + static int getEventToolType(MotionEvent event) { return event.getPointerCount() > 0 ? event.getToolType(0) : MotionEvent.TOOL_TYPE_UNKNOWN; } |