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.
This commit is contained in:
Fredia Huya-Kouadio 2024-07-17 02:44:17 -07:00
parent 8f7dc86223
commit 53a752f2d6
2 changed files with 5 additions and 2 deletions

View File

@ -76,8 +76,11 @@ internal class GodotGestureHandler(private val inputHandler: GodotInputHandler)
}
override fun onLongPress(event: MotionEvent) {
val toolType = GodotInputHandler.getEventToolType(event)
if (toolType != MotionEvent.TOOL_TYPE_MOUSE) {
contextClickRouter(event)
}
}
private fun contextClickRouter(event: MotionEvent) {
if (scaleInProgress || nextDownIsDoubleTap) {

View File

@ -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;
}