From 60b78a3dcde32cbc456d0fb05e427d0da39c041c Mon Sep 17 00:00:00 2001 From: Duy Tran Khanh Date: Sat, 6 Feb 2021 18:14:56 +0700 Subject: [PATCH] [WIP] fix the input --- Natives/SurfaceViewController.m | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Natives/SurfaceViewController.m b/Natives/SurfaceViewController.m index 76efaf57..ea88de5c 100644 --- a/Natives/SurfaceViewController.m +++ b/Natives/SurfaceViewController.m @@ -145,11 +145,9 @@ 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]; - } - + CGPoint locationInView = [sender locationInView:[sender.view superview]]; + [self sendTouchPoint:locationInView withEvent:ACTION_DOWN]; + [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, @@ -289,7 +287,9 @@ ADD_BUTTON_DEF_KEY(escape, GLFW_KEY_ESCAPE) - (void)sendTouchPoint:(CGPoint)location withEvent:(int)event{ CGFloat screenScale = [[UIScreen mainScreen] scale]; - callback_SurfaceViewController_onTouch(event, location.x * screenScale, location.y * screenScale); + // callback_SurfaceViewController_onTouch(event, location.x * screenScale, location.y * screenScale); + + Java_org_lwjgl_glfw_CallbackBridge_nativeSendCursorPos(NULL, NULL, location.x * screenScale, location.y * screenScale); } // Equals to Android ACTION_DOWN