diff --git a/VoidLink/Input/RelativeTouchHandler.m b/VoidLink/Input/RelativeTouchHandler.m index 68ee3cf7..b142daf9 100644 --- a/VoidLink/Input/RelativeTouchHandler.m +++ b/VoidLink/Input/RelativeTouchHandler.m @@ -94,6 +94,7 @@ static const float QUICK_TAP_TIME_INTERVAL = 0.2; } - (void)mouseRightClick { + multiTouchesDetected = false; dispatch_time_t delay = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)); dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0), ^{ LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, BUTTON_RIGHT); @@ -160,7 +161,7 @@ static const float QUICK_TAP_TIME_INTERVAL = 0.2; } quickTapTouch = touches.anyObject; } - + // use [event allTouches] to check if touchLockedForMouseMove is captured, if already captured, don't update touchLockedForMouseMove if(candidateTouch != nil && ![[event allTouches] containsObject:touchLockedForMouseMove]){ touchLockedForMouseMove = candidateTouch; @@ -175,7 +176,7 @@ static const float QUICK_TAP_TIME_INTERVAL = 0.2; NSSet* currentTouches = [UITouchUtil touchesIn:streamView from:event]; if(![self isOnScreenControllerBeingPressed:currentTouches]) [TouchPadGestureHandler handleGestureIn:streamView with:event]; - + if(multiTouchesDetected) return; if([touches containsObject:touchLockedForMouseMove]){ @@ -192,13 +193,18 @@ static const float QUICK_TAP_TIME_INTERVAL = 0.2; if(TouchPadGestureHandler.ctrlDown) LiSendKeyboardEvent(CommandManager.keyboardButtonMappings[@"CTRL"].shortValue,KEY_ACTION_UP,0); + NSLog(@"testtttttt %lu, %lu, %f",[UITouchUtil touchesIn:streamView from:event].count, touches.count, CACurrentMediaTime()); + NSLog(@"testtttttt666 %lu, %lu, %f",[event allTouches].count, touches.count, CACurrentMediaTime()); + + if(multiTouchesDetected){ - if([UITouchUtil touchesIn:streamView from:event].count == touches.count) multiTouchesDetected = false; + if([UITouchUtil touchesIn:streamView from:event].count == touches.count){ + + multiTouchesDetected = false;} return; } - if([UITouchUtil touchesIn:streamView from:event].count == touches.count) multiTouchesDetected = false; - + if([touches containsObject:touchLockedForMouseMove]){ // dealing with a single first tap, whether the button will be released, is going to be decided in sendLongMouseLeftButtonClickEvent if(!mousePointerMoved && !self->quickTapDetected) [self sendLongMouseLeftButtonClickEvent]; diff --git a/VoidLink/Input/TouchPadGestureHandler.swift b/VoidLink/Input/TouchPadGestureHandler.swift index f749799c..b0e2e705 100644 --- a/VoidLink/Input/TouchPadGestureHandler.swift +++ b/VoidLink/Input/TouchPadGestureHandler.swift @@ -33,13 +33,14 @@ import UIKit let midPointDeltaY = UITouchUtil.midPointDeltaY(between: touch1, and: touch2, in: view) let midPointDeltaX = UITouchUtil.midPointDeltaX(between: touch1, and: touch2, in: view) - let pinchDelta = enablePinch ? (currentDistance-previousDistance)*7*pinchSensitivity : 0; + let originalPinchDelta = currentDistance-previousDistance; + let pinchDelta = enablePinch ? originalPinchDelta*7*pinchSensitivity : 0; LiSendHighResScrollEvent(Int16(pinchDelta + midPointDeltaY*7*scrollSensitivity)) if enableHorizontalScroll {LiSendHighResHScrollEvent(Int16(-midPointDeltaX*7*scrollSensitivity))} if !enablePinch || !ctrlDownForPinch {return}; - if abs(currentDistance - previousDistance) > abs(midPointDeltaY) { + if abs(originalPinchDelta) > abs(midPointDeltaY)*1.3, abs(originalPinchDelta) > abs(midPointDeltaX)*1.3 { LiSendKeyboardEvent(CommandManager.keyboardButtonMappings["CTRL"]!, CChar(KEY_ACTION_DOWN), 0) ctrlDown = true } else {