- optimize touch pad gesture

- relative touch minor fix
This commit is contained in:
TrueZhuanjia committed 2025-11-08 00:42:26 +08:00
1 parent da4bfb851c
commit ea68353328
2 files changed
+11 -4

No files matched your search

+8 -2
View File
@@ -94,6 +94,7 @@ static const float QUICK_TAP_TIME_INTERVAL = 0.2;
} }
- (void)mouseRightClick { - (void)mouseRightClick {
multiTouchesDetected = false;
dispatch_time_t delay = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)); 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), ^{ dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0), ^{
LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, BUTTON_RIGHT); LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, BUTTON_RIGHT);
@@ -192,11 +193,16 @@ static const float QUICK_TAP_TIME_INTERVAL = 0.2;
if(TouchPadGestureHandler.ctrlDown) LiSendKeyboardEvent(CommandManager.keyboardButtonMappings[@"CTRL"].shortValue,KEY_ACTION_UP,0); 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(multiTouchesDetected){
if([UITouchUtil touchesIn:streamView from:event].count == touches.count) multiTouchesDetected = false; if([UITouchUtil touchesIn:streamView from:event].count == touches.count){
multiTouchesDetected = false;}
return; return;
} }
if([UITouchUtil touchesIn:streamView from:event].count == touches.count) multiTouchesDetected = false; if([UITouchUtil touchesIn:streamView from:event].count == touches.count) multiTouchesDetected = false;
if([touches containsObject:touchLockedForMouseMove]){ if([touches containsObject:touchLockedForMouseMove]){
+3 -2
View File
@@ -33,13 +33,14 @@ import UIKit
let midPointDeltaY = UITouchUtil.midPointDeltaY(between: touch1, and: touch2, in: view) let midPointDeltaY = UITouchUtil.midPointDeltaY(between: touch1, and: touch2, in: view)
let midPointDeltaX = UITouchUtil.midPointDeltaX(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)) LiSendHighResScrollEvent(Int16(pinchDelta + midPointDeltaY*7*scrollSensitivity))
if enableHorizontalScroll {LiSendHighResHScrollEvent(Int16(-midPointDeltaX*7*scrollSensitivity))} if enableHorizontalScroll {LiSendHighResHScrollEvent(Int16(-midPointDeltaX*7*scrollSensitivity))}
if !enablePinch || !ctrlDownForPinch {return}; 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) LiSendKeyboardEvent(CommandManager.keyboardButtonMappings["CTRL"]!, CChar(KEY_ACTION_DOWN), 0)
ctrlDown = true ctrlDown = true
} else { } else {