Skip to content

Commit

Permalink
fix(gesture): Right click not working
Browse files Browse the repository at this point in the history
Turns out if you were perfectly still, it would fail. For a quick tap, it was fairly easy to create.
  • Loading branch information
Mathias-Boulay committed Jan 7, 2025
1 parent 2e596cd commit a72451c
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@ public RightClickGesture(Handler mHandler) {
public final void inputEvent() {
if(!mGestureEnabled) return;
if(submit()) {
mGestureStartX = CallbackBridge.mouseX;
mGestureStartY = CallbackBridge.mouseY;
mGestureStartX = mGestureEndX = CallbackBridge.mouseX;
mGestureStartY = mGestureEndY = CallbackBridge.mouseY;
mGestureEnabled = false;
mGestureValid = true;
}
}

public void setMotion(float deltaX, float deltaY) {
System.out.println("set motion called");
mGestureEndX += deltaX;
mGestureEndY += deltaY;
}
Expand All @@ -49,6 +50,7 @@ public void onGestureCancelled(boolean isSwitching) {
mGestureEnabled = true;
if(!mGestureValid || isSwitching) return;
boolean fingerStill = LeftClickGesture.isFingerStill(mGestureStartX, mGestureStartY, mGestureEndX, mGestureEndY, LeftClickGesture.FINGER_STILL_THRESHOLD);
System.out.println("Right click: " + fingerStill);
if(!fingerStill) return;
CallbackBridge.sendMouseButton(LwjglGlfwKeycode.GLFW_MOUSE_BUTTON_RIGHT, true);
CallbackBridge.sendMouseButton(LwjglGlfwKeycode.GLFW_MOUSE_BUTTON_RIGHT, false);
Expand Down

0 comments on commit a72451c

Please sign in to comment.