mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-12 22:26:56 -04:00
Fix[input]: ignore the right click gesture for non-fresh inputs
This commit is contained in:
parent
7add2f85dd
commit
13cad686ec
@ -11,6 +11,7 @@ import org.lwjgl.glfw.CallbackBridge;
|
||||
public class InGameEventProcessor implements TouchEventProcessor {
|
||||
private final Handler mGestureHandler = new Handler(Looper.getMainLooper());
|
||||
private final double mSensitivity;
|
||||
private boolean mEventTransitioned = true;
|
||||
private final PointerTracker mTracker = new PointerTracker();
|
||||
private final LeftClickGesture mLeftClickGesture = new LeftClickGesture(mGestureHandler);
|
||||
private final RightClickGesture mRightClickGesture = new RightClickGesture(mGestureHandler);
|
||||
@ -25,6 +26,7 @@ public class InGameEventProcessor implements TouchEventProcessor {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
mTracker.startTracking(motionEvent);
|
||||
if(LauncherPreferences.PREF_DISABLE_GESTURES) break;
|
||||
mEventTransitioned = false;
|
||||
checkGestures();
|
||||
break;
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
@ -51,10 +53,14 @@ public class InGameEventProcessor implements TouchEventProcessor {
|
||||
|
||||
private void checkGestures() {
|
||||
mLeftClickGesture.inputEvent();
|
||||
mRightClickGesture.inputEvent();
|
||||
// Only register right click events if it's a fresh event stream, not one after a transition.
|
||||
// This is done to avoid problems when people hold the button for just a bit too long after
|
||||
// exiting a menu for example.
|
||||
if(!mEventTransitioned) mRightClickGesture.inputEvent();
|
||||
}
|
||||
|
||||
private void cancelGestures(boolean isSwitching) {
|
||||
mEventTransitioned = true;
|
||||
mLeftClickGesture.cancel(isSwitching);
|
||||
mRightClickGesture.cancel(isSwitching);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user