mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-15 15:48:26 -04:00
Fix(gui event processor): remove double clicks, handle all res when tracking still finger, instant clicks (#5635)
This commit is contained in:
parent
856bace37c
commit
d23bdb9ffa
@ -29,6 +29,8 @@ public class InGUIEventProcessor implements TouchEventProcessor {
|
||||
|
||||
@Override
|
||||
public boolean processTouchEvent(MotionEvent motionEvent) {
|
||||
boolean singleTap = mSingleTapDetector.onTouchEvent(motionEvent);
|
||||
|
||||
switch (motionEvent.getActionMasked()) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
mTracker.startTracking(motionEvent);
|
||||
@ -66,13 +68,17 @@ public class InGUIEventProcessor implements TouchEventProcessor {
|
||||
case MotionEvent.ACTION_UP:
|
||||
mScroller.resetScrollOvershoot();
|
||||
mTracker.cancelTracking();
|
||||
|
||||
// Handle single tap on gestures
|
||||
if((!LauncherPreferences.PREF_DISABLE_GESTURES || touchpadDisplayed()) && !mIsMouseDown && singleTap) {
|
||||
CallbackBridge.putMouseEventWithCoords(LwjglGlfwKeycode.GLFW_MOUSE_BUTTON_LEFT, CallbackBridge.mouseX, CallbackBridge.mouseY);
|
||||
}
|
||||
|
||||
if(mIsMouseDown) disableMouse();
|
||||
resetGesture();
|
||||
}
|
||||
|
||||
if((!LauncherPreferences.PREF_DISABLE_GESTURES || touchpadDisplayed()) && mSingleTapDetector.onTouchEvent(motionEvent)) {
|
||||
clickMouse();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -98,14 +104,9 @@ public class InGUIEventProcessor implements TouchEventProcessor {
|
||||
mIsMouseDown = false;
|
||||
}
|
||||
|
||||
private void clickMouse() {
|
||||
CallbackBridge.sendMouseButton(LwjglGlfwKeycode.GLFW_MOUSE_BUTTON_LEFT, true);
|
||||
CallbackBridge.sendMouseButton(LwjglGlfwKeycode.GLFW_MOUSE_BUTTON_LEFT, false);
|
||||
}
|
||||
|
||||
private void setGestureStart(MotionEvent event) {
|
||||
mStartX = event.getX();
|
||||
mStartY = event.getY();
|
||||
mStartX = event.getX() * mScaleFactor;
|
||||
mStartY = event.getY() * mScaleFactor;
|
||||
}
|
||||
|
||||
private void resetGesture() {
|
||||
|
@ -20,7 +20,7 @@ public class TapDetector {
|
||||
public final static int DETECTION_METHOD_UP = 0x2;
|
||||
public final static int DETECTION_METHOD_BOTH = 0x3; //Unused for now
|
||||
|
||||
private final static int TAP_MIN_DELTA_MS = 10;
|
||||
private final static int TAP_MIN_DELTA_MS = -1;
|
||||
private final static int TAP_MAX_DELTA_MS = 300;
|
||||
private final static int TAP_SLOP_SQUARE_PX = (int) Tools.dpToPx(2500);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user