[Bug fix] Click too fast caused wrong position

This commit is contained in:
Duy Tran Khanh committed 2021-02-07 10:25:41 +07:00
1 parent 895d97a639
commit 8dee3ac1bf
2 files changed
+6 -4

No files matched your search

@@ -24,6 +24,10 @@ public class UIKit {
switch (event) {
case ACTION_DOWN:
case ACTION_UP:
if (!GLFW.mGLFWIsGrabbing) {
CallbackBridge.mouseX = x;
CallbackBridge.mouseY = y;
}
CallbackBridge.mouseLastX = x;
CallbackBridge.mouseLastY = y;
break;
+2 -4
View File
@@ -75,6 +75,8 @@ UITextField *inputView;
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(surfaceOnClick:)];
tapGesture.numberOfTapsRequired = 1;
tapGesture.numberOfTouchesRequired = 1;
tapGesture.cancelsTouchesInView = NO;
[touchView addGestureRecognizer:tapGesture];
UILongPressGestureRecognizer *longpressGesture = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(surfaceOnLongpress:)];
@@ -150,10 +152,6 @@ UITextField *inputView;
- (void)surfaceOnClick:(UITapGestureRecognizer *)sender {
if (sender.state == UIGestureRecognizerStateRecognized) {
if (isGrabbing == JNI_FALSE) {
CGPoint locationInView = [sender locationInView:[sender.view superview]];
[self sendTouchPoint:locationInView withEvent:ACTION_MOVE];
}
Java_org_lwjgl_glfw_CallbackBridge_nativeSendMouseButton(NULL, NULL,
isGrabbing == JNI_TRUE ? GLFW_MOUSE_BUTTON_RIGHT : GLFW_MOUSE_BUTTON_LEFT, 1, 0);
Java_org_lwjgl_glfw_CallbackBridge_nativeSendMouseButton(NULL, NULL,