From 6ff2add9ddf3af0ffd4c80cafe37a05fa6cbd480 Mon Sep 17 00:00:00 2001 From: TrueZhuanjia Date: Tue, 14 Oct 2025 22:34:28 +0800 Subject: [PATCH] - feat: edge sliding sensitivity for edge sliding gestures - update flag for new preset widget profiles --- VoidLink/Base.lproj/iPad.storyboard | 42 +++++++++++++----- VoidLink/Base.lproj/iPhone.storyboard | 44 ++++++++++++++----- VoidLink/CountdownAlertController.swift | 7 +++ VoidLink/Database/DataManager.h | 1 + VoidLink/Database/DataManager.m | 2 + VoidLink/Database/TemporarySettings.h | 1 + VoidLink/Database/TemporarySettings.m | 1 + VoidLink/Input/AbsoluteTouchHandler.h | 2 +- VoidLink/Input/AbsoluteTouchHandler.m | 11 +++-- VoidLink/Input/CustomOSC/OSCProfilesManager.m | 9 +++- VoidLink/Input/NativeTouchHandler.h | 2 +- VoidLink/Input/NativeTouchHandler.m | 8 ++-- VoidLink/Input/OnScreenWidgetView.swift | 21 ++++++--- VoidLink/Input/PureNativeTouchHandler.h | 2 + VoidLink/Input/PureNativeTouchHandler.m | 9 ++-- VoidLink/Input/RelativeTouchHandler.h | 2 +- VoidLink/Input/RelativeTouchHandler.m | 28 ++++++------ VoidLink/Input/StreamView.m | 5 ++- .../VoidLink v1.0.xcdatamodel/contents | 1 + .../CustomEdgeSlideGestureRecognizer.h | 2 +- .../CustomEdgeSlideGestureRecognizer.m | 10 ++--- .../ViewControllers/SettingsViewController.h | 3 ++ .../ViewControllers/SettingsViewController.m | 17 ++++++- .../StreamFrameViewController.m | 18 ++++---- VoidLink/mul.lproj/iPad.xcstrings | 34 +++++++++++++- VoidLink/mul.lproj/iPhone.xcstrings | 30 +++++++++++++ 26 files changed, 233 insertions(+), 79 deletions(-) diff --git a/VoidLink/Base.lproj/iPad.storyboard b/VoidLink/Base.lproj/iPad.storyboard index 561e64d1..7a139fc3 100644 --- a/VoidLink/Base.lproj/iPad.storyboard +++ b/VoidLink/Base.lproj/iPad.storyboard @@ -956,7 +956,7 @@ - - + - + - + - + @@ -1405,6 +1405,26 @@ + + + + + + + + + + + + + + @@ -1426,6 +1446,8 @@ + + @@ -2301,7 +2323,7 @@ - + @@ -2310,13 +2332,13 @@ - + - + - + diff --git a/VoidLink/Base.lproj/iPhone.storyboard b/VoidLink/Base.lproj/iPhone.storyboard index bd38e462..0a296365 100644 --- a/VoidLink/Base.lproj/iPhone.storyboard +++ b/VoidLink/Base.lproj/iPhone.storyboard @@ -1549,7 +1549,7 @@ - + - + - + - + - + @@ -1883,7 +1883,7 @@ - + + + + + + + + + + + + + + + @@ -2208,6 +2228,8 @@ + + @@ -2335,19 +2357,19 @@ - + - + - + - + diff --git a/VoidLink/CountdownAlertController.swift b/VoidLink/CountdownAlertController.swift index da5580c2..74f262fd 100644 --- a/VoidLink/CountdownAlertController.swift +++ b/VoidLink/CountdownAlertController.swift @@ -47,8 +47,15 @@ import UIKit if withCancel {alert.addAction(cancelAction)} alert.addAction(confirmAction) + + if(countdown == 0) { + confirmAction.setValue(buttonTitle, forKey: "title") + confirmAction.isEnabled = true + } viewController.present(alert, animated: true, completion: nil) + + if(countdown == 0) {return} // 倒计时 let timer = DispatchSource.makeTimerSource(queue: DispatchQueue.main) diff --git a/VoidLink/Database/DataManager.h b/VoidLink/Database/DataManager.h index ca1c5bb8..5774bd79 100644 --- a/VoidLink/Database/DataManager.h +++ b/VoidLink/Database/DataManager.h @@ -119,6 +119,7 @@ typedef NS_ENUM(NSInteger, WidgetSizeTransition) { rememberFoldState:(BOOL)rememberFoldState singleTapSensitivy:(CGFloat)singleTapSensitivy hapticEngine:(NSInteger)hapticEngine + edgeSlidingSensitivity:(CGFloat)edgeSlidingSensitivity backgroundSessionTimer:(NSInteger)backgroundSessionTimer; - (NSArray*) getHosts; diff --git a/VoidLink/Database/DataManager.m b/VoidLink/Database/DataManager.m index 2e58d9d7..5c757fac 100644 --- a/VoidLink/Database/DataManager.m +++ b/VoidLink/Database/DataManager.m @@ -107,6 +107,7 @@ rememberFoldState:(BOOL)rememberFoldState singleTapSensitivy:(CGFloat)singleTapSensitivy hapticEngine:(NSInteger)hapticEngine + edgeSlidingSensitivity:(CGFloat)edgeSlidingSensitivity backgroundSessionTimer:(NSInteger)backgroundSessionTimer{ [_managedObjectContext performBlockAndWait:^{ @@ -164,6 +165,7 @@ settingsToSave.sendDummyEvent = sendDummyEvent; settingsToSave.singleTapSensitivity = [NSNumber numberWithDouble:singleTapSensitivy]; settingsToSave.hapticEngine = [NSNumber numberWithInteger:hapticEngine]; + settingsToSave.edgeSlidingSensitivity = [NSNumber numberWithFloat:edgeSlidingSensitivity]; settingsToSave.rememberFoldState = rememberFoldState; [self saveData]; }]; diff --git a/VoidLink/Database/TemporarySettings.h b/VoidLink/Database/TemporarySettings.h index 754c8c2d..5fe019a4 100644 --- a/VoidLink/Database/TemporarySettings.h +++ b/VoidLink/Database/TemporarySettings.h @@ -80,6 +80,7 @@ @property (nonatomic) BOOL rememberFoldState; @property (nonatomic, retain) NSNumber * singleTapSensitivity; @property (nonatomic, retain) NSNumber * hapticEngine; +@property (nonatomic, retain) NSNumber * edgeSlidingSensitivity; @property (nonatomic, retain) NSNumber * framePacingMode; - (id) initFromSettings:(Settings*)settings; diff --git a/VoidLink/Database/TemporarySettings.m b/VoidLink/Database/TemporarySettings.m index 856a9298..f3b1ba25 100644 --- a/VoidLink/Database/TemporarySettings.m +++ b/VoidLink/Database/TemporarySettings.m @@ -135,6 +135,7 @@ self.gyroBiasZ = settings.gyroBiasZ; self.singleTapSensitivity = settings.singleTapSensitivity; self.backgroundSessionTimer = settings.backroundSessionTimer; + self.edgeSlidingSensitivity = settings.edgeSlidingSensitivity; self.hapticEngine = settings.hapticEngine; #endif self.uniqueId = settings.uniqueId; diff --git a/VoidLink/Input/AbsoluteTouchHandler.h b/VoidLink/Input/AbsoluteTouchHandler.h index cbdb455d..2913d561 100644 --- a/VoidLink/Input/AbsoluteTouchHandler.h +++ b/VoidLink/Input/AbsoluteTouchHandler.h @@ -12,7 +12,7 @@ NS_ASSUME_NONNULL_BEGIN @interface AbsoluteTouchHandler : UIResponder --(id)initWithView:(StreamView*)view; +- (id)initWithView:(StreamView*)view andSettings:(TemporarySettings*)settings; @end diff --git a/VoidLink/Input/AbsoluteTouchHandler.m b/VoidLink/Input/AbsoluteTouchHandler.m index 2875bf55..c356387d 100644 --- a/VoidLink/Input/AbsoluteTouchHandler.m +++ b/VoidLink/Input/AbsoluteTouchHandler.m @@ -38,18 +38,17 @@ bool touchPointSpawnedAtUpperScreenEdge; CGFloat slideGestureVerticalThreshold; CGFloat screenWidthWithThreshold; - CGFloat EDGE_TOLERANCE; - + CGFloat _edgeTolerance; } -- (id)initWithView:(StreamView*)view { +- (id)initWithView:(StreamView*)view andSettings:(TemporarySettings*)settings { self = [self init]; self->streamView = view; // upper screen check - EDGE_TOLERANCE = 10.0; + _edgeTolerance = settings.edgeSlidingSensitivity.floatValue; slideGestureVerticalThreshold = CGRectGetHeight([[UIScreen mainScreen] bounds]) * 0.4; - screenWidthWithThreshold = CGRectGetWidth([[UIScreen mainScreen] bounds]) - EDGE_TOLERANCE; + screenWidthWithThreshold = CGRectGetWidth([[UIScreen mainScreen] bounds]) - _edgeTolerance; self->touchPointSpawnedAtUpperScreenEdge = false; return self; @@ -64,7 +63,7 @@ - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { CGPoint initialPoint = [[touches anyObject] locationInView:streamView]; - if(initialPoint.y < slideGestureVerticalThreshold && (initialPoint.x < EDGE_TOLERANCE || initialPoint.x > screenWidthWithThreshold)) { + if(initialPoint.y < slideGestureVerticalThreshold && (initialPoint.x < _edgeTolerance || initialPoint.x > screenWidthWithThreshold)) { self->touchPointSpawnedAtUpperScreenEdge = true; return; // we're done here. this touch event will not be sent to the remote PC. } diff --git a/VoidLink/Input/CustomOSC/OSCProfilesManager.m b/VoidLink/Input/CustomOSC/OSCProfilesManager.m index 9e1680bb..b36bb033 100644 --- a/VoidLink/Input/CustomOSC/OSCProfilesManager.m +++ b/VoidLink/Input/CustomOSC/OSCProfilesManager.m @@ -227,8 +227,15 @@ static CGRect layoutViewBounds; - (OSCProfile *) getSelectedProfile { NSMutableArray *profiles = [self getAllProfiles]; - if(profiles.count == 0){ + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; + + NSString* persistedKey = @"widgetProfileUpdated-20251015"; + BOOL needImportDefaultTemplates = [defaults objectForKey:persistedKey] == nil; + + if(profiles.count == 0 || needImportDefaultTemplates){ [self importDefaultTemplates]; + [[NSUserDefaults standardUserDefaults] setBool:YES forKey:persistedKey]; + [[NSUserDefaults standardUserDefaults] synchronize]; profiles = [self getAllProfiles]; } for (OSCProfile *profile in profiles) { diff --git a/VoidLink/Input/NativeTouchHandler.h b/VoidLink/Input/NativeTouchHandler.h index b80a3825..1df681e1 100644 --- a/VoidLink/Input/NativeTouchHandler.h +++ b/VoidLink/Input/NativeTouchHandler.h @@ -14,8 +14,8 @@ NS_ASSUME_NONNULL_BEGIN @interface NativeTouchHandler : UIResponder -@property (nonatomic, assign) NSMutableSet* touchesCapturedByOnScreenButtons; +@property (nonatomic, assign) NSMutableSet* touchesCapturedByOnScreenButtons; - (id)initWithView:(StreamView* )view andSettings:(TemporarySettings*)settings; diff --git a/VoidLink/Input/NativeTouchHandler.m b/VoidLink/Input/NativeTouchHandler.m index 1e9b66be..dd2e440a 100644 --- a/VoidLink/Input/NativeTouchHandler.m +++ b/VoidLink/Input/NativeTouchHandler.m @@ -38,7 +38,7 @@ CGFloat slideGestureVerticalThreshold; CGFloat screenWidthWithThreshold; - CGFloat EDGE_TOLERANCE; + CGFloat _edgeTolerance; CGRect streamViewBounds; @@ -85,9 +85,9 @@ self->pointerObjDict = [NSMutableDictionary dictionary]; - EDGE_TOLERANCE = 10.0; + _edgeTolerance = settings.edgeSlidingSensitivity.floatValue; slideGestureVerticalThreshold = CGRectGetHeight([[UIScreen mainScreen] bounds]) * 0.4; - screenWidthWithThreshold = CGRectGetWidth([[UIScreen mainScreen] bounds]) - EDGE_TOLERANCE; + screenWidthWithThreshold = CGRectGetWidth([[UIScreen mainScreen] bounds]) - _edgeTolerance; self->pointerVelocityDividerLocationByPoints = self->streamView.bounds.size.width * settings.pointerVelocityModeDivider.floatValue; @@ -164,7 +164,7 @@ //check if touch point is spawned on the left or right upper half screen edges, event to remote PC. this is for better handling in-stream slide gesture CGPoint initialPoint = [touch locationInView:self->streamView]; - if(initialPoint.y < slideGestureVerticalThreshold && (initialPoint.x < EDGE_TOLERANCE || initialPoint.x > screenWidthWithThreshold)) { + if(initialPoint.y < slideGestureVerticalThreshold && (initialPoint.x < _edgeTolerance || initialPoint.x > screenWidthWithThreshold)) { [blacklistedTouches addObject:touchAddrObj]; } } diff --git a/VoidLink/Input/OnScreenWidgetView.swift b/VoidLink/Input/OnScreenWidgetView.swift index 96913859..5e0c9d71 100644 --- a/VoidLink/Input/OnScreenWidgetView.swift +++ b/VoidLink/Input/OnScreenWidgetView.swift @@ -1266,7 +1266,7 @@ import UIKit } self.motionHandler.mixLeftStickAndGyroInput(x: targetX, y: targetY) } - + private func sendLeftTriggerTouchPadEvent(inputY: CGFloat){ self.onScreenControls.updateLeftTrigger(UInt8(max(min(inputY,255),0))) } @@ -1477,7 +1477,7 @@ import UIKit else {return} } - if !firstTouchMoved { + if !firstTouchMoved, !self.isAdjacentPoints(currentLocation, from: latestTouchLocation, tolerance: 0.5) { // First move event self.latestTouchLocation = currentLocation self.firstTouchMoved = true @@ -1489,7 +1489,7 @@ import UIKit let outOfBoundsX = center.x+offsetX >= (self.superview?.bounds.width)! || center.x+offsetX < 0 let outOfBoundsY = center.y+offsetY >= (self.superview?.bounds.height)! || center.y+offsetY < 0 - center = CGPoint(x: outOfBoundsX ? center.x : center.x+offsetX, y: outOfBoundsY ? center.y : center.y+offsetY) + if firstTouchMoved {center = CGPoint(x: outOfBoundsX ? center.x : center.x+offsetX, y: outOfBoundsY ? center.y : center.y+offsetY)} latestTouchLocation = currentLocation @@ -1632,11 +1632,20 @@ import UIKit } } + func isAdjacentPoints(_ currentPoint: CGPoint, from originalPoint: CGPoint, tolerance: CGFloat) -> Bool { + let distance = hypot(originalPoint.x - currentPoint.x, originalPoint.y - currentPoint.y) + let threshold = hypot(tolerance, tolerance) + return distance <= threshold + } + private func updateTouchLocation (touch: UITouch) { - self.mousePointerMoved = true let currentTouchLocation: CGPoint = (touch.location(in: self)) - if !firstTouchMoved { + if !self.mousePointerMoved, !self.isAdjacentPoints(currentTouchLocation, from: latestTouchLocation, tolerance: 2.0){ + self.mousePointerMoved = true + } + + if !firstTouchMoved, !self.isAdjacentPoints(currentTouchLocation, from: latestTouchLocation, tolerance: 0.5) { // First move event self.latestTouchLocation = currentTouchLocation self.firstTouchMoved = true @@ -1704,7 +1713,7 @@ import UIKit handleLrudTouchMove() case "MOUSEWHEEL","WHEEL": self.updateTouchLocation(touch: touches.first!) - LiSendHighResScrollEvent(Int16(self.deltaY*7.5*self.sensitivityFactorY)) + if firstTouchMoved {LiSendHighResScrollEvent(Int16(self.deltaY*7.5*self.sensitivityFactorY))} default: break } diff --git a/VoidLink/Input/PureNativeTouchHandler.h b/VoidLink/Input/PureNativeTouchHandler.h index e6aadb08..be7d0626 100644 --- a/VoidLink/Input/PureNativeTouchHandler.h +++ b/VoidLink/Input/PureNativeTouchHandler.h @@ -14,6 +14,8 @@ NS_ASSUME_NONNULL_BEGIN @interface PureNativeTouchHandler : UIResponder + + - (id)initWithView:(StreamView*)view andSettings:(TemporarySettings*)settings; diff --git a/VoidLink/Input/PureNativeTouchHandler.m b/VoidLink/Input/PureNativeTouchHandler.m index 7602a9e6..36bbc2ae 100644 --- a/VoidLink/Input/PureNativeTouchHandler.m +++ b/VoidLink/Input/PureNativeTouchHandler.m @@ -38,7 +38,7 @@ CGFloat slideGestureVerticalThreshold; CGFloat screenWidthWithThreshold; - CGFloat EDGE_TOLERANCE; + CGFloat _edgeTolerance; CGRect streamViewBounds; @@ -82,12 +82,11 @@ default: break; } - self->pointerObjDict = [NSMutableDictionary dictionary]; - EDGE_TOLERANCE = 10.0; + _edgeTolerance = settings.edgeSlidingSensitivity.floatValue; slideGestureVerticalThreshold = CGRectGetHeight([[UIScreen mainScreen] bounds]) * 0.4; - screenWidthWithThreshold = CGRectGetWidth([[UIScreen mainScreen] bounds]) - EDGE_TOLERANCE; + screenWidthWithThreshold = CGRectGetWidth([[UIScreen mainScreen] bounds]) - _edgeTolerance; self->pointerVelocityDividerLocationByPoints = self->streamView.bounds.size.width * settings.pointerVelocityModeDivider.floatValue; @@ -164,7 +163,7 @@ //check if touch point is spawned on the left or right upper half screen edges, event to remote PC. this is for better handling in-stream slide gesture CGPoint initialPoint = [touch locationInView:self->streamView]; - if(initialPoint.y < slideGestureVerticalThreshold && (initialPoint.x < EDGE_TOLERANCE || initialPoint.x > screenWidthWithThreshold)) { + if(initialPoint.y < slideGestureVerticalThreshold && (initialPoint.x < _edgeTolerance || initialPoint.x > screenWidthWithThreshold)) { [blacklistedTouches addObject:touchAddrObj]; } } diff --git a/VoidLink/Input/RelativeTouchHandler.h b/VoidLink/Input/RelativeTouchHandler.h index 0bd4a512..a23cb415 100644 --- a/VoidLink/Input/RelativeTouchHandler.h +++ b/VoidLink/Input/RelativeTouchHandler.h @@ -18,8 +18,8 @@ NS_ASSUME_NONNULL_BEGIN @interface RelativeTouchHandler : UIResponder -@property (nonatomic, readonly) CustomTapGestureRecognizer* mouseRightClickTapRecognizer; // this object will be passed to onscreencontrol class for areVirtualControllerTaps flag setting +@property (nonatomic, readonly) CustomTapGestureRecognizer* mouseRightClickTapRecognizer; // this object will be passed to onscreencontrol class for areVirtualControllerTaps flag setting - (id)initWithView:(StreamView*)view andSettings:(TemporarySettings*)settings; diff --git a/VoidLink/Input/RelativeTouchHandler.m b/VoidLink/Input/RelativeTouchHandler.m index b247b64e..2e76e830 100644 --- a/VoidLink/Input/RelativeTouchHandler.m +++ b/VoidLink/Input/RelativeTouchHandler.m @@ -29,7 +29,7 @@ static const float QUICK_TAP_TIME_INTERVAL = 0.2; bool touchPointSpawnedAtUpperScreenEdge; CGFloat slideGestureVerticalThreshold; CGFloat screenWidthWithThreshold; - CGFloat EDGE_TOLERANCE; + CGFloat _edgeTolerance; UITouch* touchLockedForMouseMove; @@ -62,9 +62,9 @@ static const float QUICK_TAP_TIME_INTERVAL = 0.2; mousePointerTimestamp = 0; // upper screen check - EDGE_TOLERANCE = 10.0; + _edgeTolerance = settings.edgeSlidingSensitivity.floatValue; slideGestureVerticalThreshold = CGRectGetHeight([[UIScreen mainScreen] bounds]) * 0.4; - screenWidthWithThreshold = CGRectGetWidth([[UIScreen mainScreen] bounds]) - EDGE_TOLERANCE; + screenWidthWithThreshold = CGRectGetWidth([[UIScreen mainScreen] bounds]) - _edgeTolerance; self->touchPointSpawnedAtUpperScreenEdge = false; // self->displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(displayLinkCallback:)]; @@ -137,8 +137,8 @@ static const float QUICK_TAP_TIME_INTERVAL = 0.2; return hypotf(originalPoint.x - currentPoint.x, originalPoint.y - currentPoint.y) <= 300; } -- (BOOL)isAdjacentPoints:(CGPoint)currentPoint from:(CGPoint)originalPoint { - bool isAdjacent = hypotf(originalPoint.x - currentPoint.x, originalPoint.y - currentPoint.y) <= hypot(currentSettings.singleTapSensitivity.doubleValue, currentSettings.singleTapSensitivity.doubleValue); +- (BOOL)isAdjacentPoints:(CGPoint)currentPoint from:(CGPoint)originalPoint tolerance:(CGFloat)tolerance { + bool isAdjacent = hypotf(originalPoint.x - currentPoint.x, originalPoint.y - currentPoint.y) <= hypot(tolerance, tolerance); return isAdjacent; } @@ -147,7 +147,7 @@ static const float QUICK_TAP_TIME_INTERVAL = 0.2; //check if touch point is spawned on the left or right upper half screen edges, this is the highest priority CGPoint initialPoint = [[touches anyObject] locationInView:streamView]; - if(initialPoint.y < slideGestureVerticalThreshold && (initialPoint.x < EDGE_TOLERANCE || initialPoint.x > screenWidthWithThreshold)) { + if(initialPoint.y < slideGestureVerticalThreshold && (initialPoint.x < _edgeTolerance || initialPoint.x > screenWidthWithThreshold)) { self->touchPointSpawnedAtUpperScreenEdge = true; return; } @@ -215,10 +215,12 @@ static const float QUICK_TAP_TIME_INTERVAL = 0.2; // NSLog(@"%f touchesMoved callback, locked touch: %llu", CACurrentMediaTime(), (uintptr_t)touchLockedForMouseMove); if([touches containsObject:touchLockedForMouseMove]){ - if(!mousePointerMoved && ![self isAdjacentPoints:initialMousePointerLocation from:[touchLockedForMouseMove locationInView:streamView]]){ + CGPoint currentLocation = [touchLockedForMouseMove locationInView:streamView]; + bool isAdjacentPoints = [self isAdjacentPoints:initialMousePointerLocation from:currentLocation tolerance:currentSettings.singleTapSensitivity.doubleValue]; + if(!mousePointerMoved && !isAdjacentPoints){ mousePointerMoved = true; } - [self sendMouseMoveEvent:touchLockedForMouseMove]; + [self sendMouseMoveEvent:currentLocation]; } } @@ -263,12 +265,12 @@ static const float QUICK_TAP_TIME_INTERVAL = 0.2; }); } -- (void)sendMouseMoveEvent:(UITouch* )touch{ +- (void)sendMouseMoveEvent:(CGPoint)currentLocation{ dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0), ^{ - CGPoint currentLocation = [touch locationInView:self->streamView]; - - if (!self->firstTouchMoved) { + bool isAdjacentPoints = [self isAdjacentPoints:self->initialMousePointerLocation from:currentLocation tolerance:0.5]; + + if (!self->firstTouchMoved && !isAdjacentPoints) { self->latestMousePointerLocation = currentLocation; self->firstTouchMoved = true; } @@ -282,7 +284,7 @@ static const float QUICK_TAP_TIME_INTERVAL = 0.2; if (deltaX != 0 || deltaY != 0) { self->latestMousePointerLocation = currentLocation; if(self->touchPointSpawnedAtUpperScreenEdge) return; // we're done here. this touch event will not be sent to the remote PC. - LiSendMouseMoveEvent(deltaX, deltaY); + if(self->firstTouchMoved) LiSendMouseMoveEvent(deltaX, deltaY); } } }); diff --git a/VoidLink/Input/StreamView.m b/VoidLink/Input/StreamView.m index 132305ab..21195288 100644 --- a/VoidLink/Input/StreamView.m +++ b/VoidLink/Input/StreamView.m @@ -132,7 +132,8 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5; switch (settings.touchMode.intValue) { case NativeTouch: keyboardToggleRecognizer.immediateTriggering = false; - self->touchHandler = [[NativeTouchHandler alloc] initWithView:self andSettings:settings];break; + self->touchHandler = [[NativeTouchHandler alloc] initWithView:self andSettings:settings]; + break; case NativeTouchOnly: keyboardToggleRecognizer.immediateTriggering = false; self->touchHandler = [[PureNativeTouchHandler alloc] initWithView:self andSettings:settings];break; @@ -142,7 +143,7 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5; // if(settings.onscreenControls.intValue == OnScreenControlsLevelCustom) keyboardToggleRecognizer.numberOfTouchesRequired = 3; //deprecated: fixing keyboard taps to 3, in order to invoke OSC rebase in stream view by 4-finger tap. break; case AbsoluteTouch: - self->touchHandler = [[AbsoluteTouchHandler alloc] initWithView:self]; + self->touchHandler = [[AbsoluteTouchHandler alloc] initWithView:self andSettings:settings]; keyboardToggleRecognizer.immediateTriggering = true; //triggers signal in touchesBegan callback stage break; case TouchDisabled: diff --git a/VoidLink/Limelight.xcdatamodeld/VoidLink v1.0.xcdatamodel/contents b/VoidLink/Limelight.xcdatamodeld/VoidLink v1.0.xcdatamodel/contents index 89cee3aa..ae4fb740 100644 --- a/VoidLink/Limelight.xcdatamodeld/VoidLink v1.0.xcdatamodel/contents +++ b/VoidLink/Limelight.xcdatamodeld/VoidLink v1.0.xcdatamodel/contents @@ -28,6 +28,7 @@ + diff --git a/VoidLink/ViewControllers/CustomEdgeSlideGestureRecognizer.h b/VoidLink/ViewControllers/CustomEdgeSlideGestureRecognizer.h index 1924200c..0cde9ed2 100644 --- a/VoidLink/ViewControllers/CustomEdgeSlideGestureRecognizer.h +++ b/VoidLink/ViewControllers/CustomEdgeSlideGestureRecognizer.h @@ -16,7 +16,7 @@ @property (nonatomic, assign) UIRectEdge edges; // Specify the edge(s) you want to recognize the swipe gesture on @property (nonatomic, assign) CGFloat normalizedThresholdDistance; // Distance from the edge to start recognizing the gesture @property (nonatomic, assign) bool immediateTriggering; -@property (nonatomic, assign) CGFloat EDGE_TOLERANCE; +@property (nonatomic, assign) CGFloat edgeTolerance; @end #endif /* CustomEdgeSlideGestureRecognizer_h */ diff --git a/VoidLink/ViewControllers/CustomEdgeSlideGestureRecognizer.m b/VoidLink/ViewControllers/CustomEdgeSlideGestureRecognizer.m index af0e2a39..29bfbf9f 100644 --- a/VoidLink/ViewControllers/CustomEdgeSlideGestureRecognizer.m +++ b/VoidLink/ViewControllers/CustomEdgeSlideGestureRecognizer.m @@ -20,7 +20,7 @@ CGFloat startPointX; self = [super initWithTarget:target action:action]; // screenWidthInPoints = CGRectGetWidth([UIApplication.sharedApplication.windows.firstObject.screen bounds]); // Get the screen's bounds (in points) _immediateTriggering = false; - _EDGE_TOLERANCE = 10.0f; + _edgeTolerance = 10.0f; return self; } @@ -33,13 +33,13 @@ CGFloat startPointX; if(_immediateTriggering){ if(self.edges & UIRectEdgeLeft){ - if(startPointX < _EDGE_TOLERANCE){ + if(startPointX < _edgeTolerance){ self.state = UIGestureRecognizerStateEnded; } // NSLog(@"startPointX %f , normalizedGestureDeltaX %f", startPointX, normalizedGestureDistance); } if(self.edges & UIRectEdgeRight){ - if(startPointX > streamFrameViewWidthInPoints - _EDGE_TOLERANCE){ + if(startPointX > streamFrameViewWidthInPoints - _edgeTolerance){ self.state = UIGestureRecognizerStateEnded; } // NSLog(@"startPointX %f , normalizedGestureDeltaX %f", startPointX, normalizedGestureDistance); @@ -57,13 +57,13 @@ CGFloat startPointX; CGFloat normalizedGestureDistance = fabs(_endPointX - startPointX)/screenWidthInPoints; if(self.edges & UIRectEdgeLeft){ - if(startPointX < _EDGE_TOLERANCE && normalizedGestureDistance > _normalizedThresholdDistance){ + if(startPointX < _edgeTolerance && normalizedGestureDistance > _normalizedThresholdDistance){ self.state = UIGestureRecognizerStateEnded; } // NSLog(@"startPointX %f , normalizedGestureDeltaX %f", startPointX, normalizedGestureDistance); } if(self.edges & UIRectEdgeRight){ - if((startPointX > (screenWidthInPoints - _EDGE_TOLERANCE)) && normalizedGestureDistance > _normalizedThresholdDistance){ + if((startPointX > (screenWidthInPoints - _edgeTolerance)) && normalizedGestureDistance > _normalizedThresholdDistance){ self.state = UIGestureRecognizerStateEnded; } // NSLog(@"startPointX %f , normalizedGestureDeltaX %f", startPointX, normalizedGestureDistance); diff --git a/VoidLink/ViewControllers/SettingsViewController.h b/VoidLink/ViewControllers/SettingsViewController.h index 667dff25..dc9e0abe 100644 --- a/VoidLink/ViewControllers/SettingsViewController.h +++ b/VoidLink/ViewControllers/SettingsViewController.h @@ -172,6 +172,9 @@ @property (strong, nonatomic) IBOutlet UIStackView *hapticEngineStack; @property (strong, nonatomic) IBOutlet UISegmentedControl *hapticEngineSelector; +@property (strong, nonatomic) IBOutlet UIStackView *edgeSlidingSensitivityStack; +@property (strong, nonatomic) IBOutlet UISlider *edgeSlidingSensitivitySlider; + @property (strong, nonatomic) IBOutlet UIStackView *testStack; @property (nonatomic, strong) MicHandler *micHandler; diff --git a/VoidLink/ViewControllers/SettingsViewController.m b/VoidLink/ViewControllers/SettingsViewController.m index d455ede1..71056a9d 100644 --- a/VoidLink/ViewControllers/SettingsViewController.m +++ b/VoidLink/ViewControllers/SettingsViewController.m @@ -737,6 +737,7 @@ BOOL isCustomResolution(int resolutionSelected) { [self addSetting:self.slideToSettingsScreenEdgeStack ofId:@"slideToSettingsScreenEdgeStack" withInfoTag:NO withDynamicLabel:NO to:gesturesSection]; [self addSetting:self.slideToToolboxScreenEdgeStack ofId:@"slideToToolboxScreenEdgeStack" withInfoTag:NO withDynamicLabel:NO to:gesturesSection]; [self addSetting:self.slideToSettingsDistanceStack ofId:@"slideToSettingsDistanceStack" withInfoTag:YES withDynamicLabel:YES to:gesturesSection]; + [self addSetting:self.edgeSlidingSensitivityStack ofId:@"edgeSlidingSensitivityStack" withInfoTag:YES withDynamicLabel:YES to:gesturesSection]; [gesturesSection addToParentStack:_parentStack]; // [gesturesSection setExpanded:NO]; @@ -1512,7 +1513,7 @@ BOOL isCustomResolution(int resolutionSelected) { self->slideToCloseSettingsViewRecognizer = [[CustomEdgeSlideGestureRecognizer alloc] initWithTarget:self action:@selector(edgeSwiped)]; self->slideToCloseSettingsViewRecognizer.edges = UIRectEdgeLeft; self->slideToCloseSettingsViewRecognizer.normalizedThresholdDistance = 0.0; - self->slideToCloseSettingsViewRecognizer.EDGE_TOLERANCE = 10; + self->slideToCloseSettingsViewRecognizer.edgeTolerance = 10; self->slideToCloseSettingsViewRecognizer.immediateTriggering = true; self->slideToCloseSettingsViewRecognizer.delaysTouchesBegan = NO; self->slideToCloseSettingsViewRecognizer.delaysTouchesEnded = NO; @@ -1773,7 +1774,9 @@ BOOL isCustomResolution(int resolutionSelected) { [self.slideToMenuDistanceSlider addTarget:self action:@selector(slideToMenuDistanceSliderMoved:) forControlEvents:(UIControlEventValueChanged)]; // Update label display when slider is being moved. [self slideToMenuDistanceSliderMoved:self.slideToMenuDistanceSlider]; - + [self.edgeSlidingSensitivitySlider setValue:self->tempSettings.edgeSlidingSensitivity.floatValue]; + [self.edgeSlidingSensitivitySlider addTarget:self action:@selector(edgeSlidingSensitivitySliderMoved:) forControlEvents:(UIControlEventValueChanged)]; // Update label display when slider is being moved. + [self edgeSlidingSensitivitySliderMoved:self.edgeSlidingSensitivitySlider]; //TouchMode & OSC Related Settings: @@ -2549,6 +2552,14 @@ BOOL isCustomResolution(int resolutionSelected) { displayLabel.text = [NSString stringWithFormat:@" %@ ", labelText]; } +- (void) edgeSlidingSensitivitySliderMoved:(UISlider* )sender{ + UILabel* displayLabel = [self findDynamicLabelFromStack:_edgeSlidingSensitivityStack]; + // displayLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightMedium]; + NSString* labelText = [LocalizationHelper localizedStringForKey:@" %d ", (uint8_t)sender.value]; + displayLabel.text = [NSString stringWithFormat:@" %@ ", labelText]; +} + + - (void) bitrateSliderMoved { assert(self.bitrateSlider.value < (sizeof(bitrateTable) / sizeof(*bitrateTable))); _bitrate = bitrateTable[(int)self.bitrateSlider.value]; @@ -2811,6 +2822,7 @@ BOOL isCustomResolution(int resolutionSelected) { BOOL rememberFoldState = self.rememberFoldStateSwitch.isOn; CGFloat singleTapSensitivity = self.singleTapSensitivitySlider.value; NSInteger hapticEngine = self.hapticEngineSelector.selectedSegmentIndex; + CGFloat edgeSlidingSensitivity = self.edgeSlidingSensitivitySlider.value; NSInteger backgroundSessionTimer = self.backgroundSessionTimerSlider.value == self.backgroundSessionTimerSlider.maximumValue ? (uint32_t) INT16_MAX : (uint32_t)self.backgroundSessionTimerSlider.value; [dataMan saveSettingsWithBitrate:_bitrate @@ -2864,6 +2876,7 @@ BOOL isCustomResolution(int resolutionSelected) { rememberFoldState:rememberFoldState singleTapSensitivy:singleTapSensitivity hapticEngine:hapticEngine + edgeSlidingSensitivity:edgeSlidingSensitivity backgroundSessionTimer:backgroundSessionTimer]; } diff --git a/VoidLink/ViewControllers/StreamFrameViewController.m b/VoidLink/ViewControllers/StreamFrameViewController.m index 628f43db..d715f4c7 100644 --- a/VoidLink/ViewControllers/StreamFrameViewController.m +++ b/VoidLink/ViewControllers/StreamFrameViewController.m @@ -84,7 +84,7 @@ #if !TARGET_OS_TV CustomEdgeSlideGestureRecognizer *_slideToSettingsRecognizer; - CustomEdgeSlideGestureRecognizer *_slideToCmdToolRecognizer; + CustomEdgeSlideGestureRecognizer *_slideToToolboxRecognizer; CustomTapGestureRecognizer *_oscLayoutTapRecoginizer; LayoutOnScreenControlsViewController *_layoutOnScreenControlsVC; ToolboxViewController* toolBoxViewController; @@ -281,6 +281,7 @@ - (void)configGestures{ _slideToSettingsRecognizer = [[CustomEdgeSlideGestureRecognizer alloc] initWithTarget:self action:@selector(edgeSwiped)]; + _slideToSettingsRecognizer.edgeTolerance = _settings.edgeSlidingSensitivity.floatValue; _slideToSettingsRecognizer.edges = _settings.slideToSettingsScreenEdge.intValue; _slideToSettingsRecognizer.normalizedThresholdDistance = _settings.slideToSettingsDistance.floatValue; _slideToSettingsRecognizer.delaysTouchesBegan = NO; @@ -288,13 +289,14 @@ [self.view addGestureRecognizer:_slideToSettingsRecognizer]; - _slideToCmdToolRecognizer = [[CustomEdgeSlideGestureRecognizer alloc] initWithTarget:self action:@selector(bringUpToolboxMenu)]; - if(_settings.slideToSettingsScreenEdge.intValue == UIRectEdgeLeft) _slideToCmdToolRecognizer.edges = UIRectEdgeRight; - else _slideToCmdToolRecognizer.edges = UIRectEdgeLeft; // _commandManager triggered by sliding from another side. - _slideToCmdToolRecognizer.normalizedThresholdDistance = _settings.slideToSettingsDistance.floatValue; - _slideToCmdToolRecognizer.delaysTouchesBegan = NO; - _slideToCmdToolRecognizer.delaysTouchesEnded = NO; - [self.view addGestureRecognizer:_slideToCmdToolRecognizer]; + _slideToToolboxRecognizer = [[CustomEdgeSlideGestureRecognizer alloc] initWithTarget:self action:@selector(bringUpToolboxMenu)]; + _slideToToolboxRecognizer.edgeTolerance = _settings.edgeSlidingSensitivity.floatValue; + if(_settings.slideToSettingsScreenEdge.intValue == UIRectEdgeLeft) _slideToToolboxRecognizer.edges = UIRectEdgeRight; + else _slideToToolboxRecognizer.edges = UIRectEdgeLeft; // _commandManager triggered by sliding from another side. + _slideToToolboxRecognizer.normalizedThresholdDistance = _settings.slideToSettingsDistance.floatValue; + _slideToToolboxRecognizer.delaysTouchesBegan = NO; + _slideToToolboxRecognizer.delaysTouchesEnded = NO; + [self.view addGestureRecognizer:_slideToToolboxRecognizer]; if([self isOscLayoutToolEnabled]){ _oscLayoutTapRecoginizer = [[CustomTapGestureRecognizer alloc] initWithTarget:self action:@selector(handleWidgetLayoutGesture)]; diff --git a/VoidLink/mul.lproj/iPad.xcstrings b/VoidLink/mul.lproj/iPad.xcstrings index 0fff3062..d0feeff4 100644 --- a/VoidLink/mul.lproj/iPad.xcstrings +++ b/VoidLink/mul.lproj/iPad.xcstrings @@ -823,6 +823,36 @@ } } }, + "aGg-ET-e9F.text" : { + "comment" : "Class = \"UILabel\"; text = \"Edge Trigger Sensitivity\"; ObjectID = \"aGg-ET-e9F\";", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Edge Trigger Sensitivity" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "needs_review", + "value" : "边缘触发灵敏度" + } + }, + "zh-Hant" : { + "stringUnit" : { + "state" : "needs_review", + "value" : "邊緣觸發靈敏度" + } + }, + "zh-HK" : { + "stringUnit" : { + "state" : "needs_review", + "value" : "邊緣觸發靈敏度" + } + } + } + }, "Aiv-r8-9k2.text" : { "comment" : "Class = \"UILabel\"; text = \"Frame Rate\"; ObjectID = \"Aiv-r8-9k2\";", "extractionState" : "extracted_with_value", @@ -3560,13 +3590,13 @@ } }, "pMN-6T-aYE.text" : { - "comment" : "Class = \"UILabel\"; text = \"Gesture Slide Distance\"; ObjectID = \"pMN-6T-aYE\";", + "comment" : "Class = \"UILabel\"; text = \"Gesture Sliding Distance\"; ObjectID = \"pMN-6T-aYE\";", "extractionState" : "extracted_with_value", "localizations" : { "en" : { "stringUnit" : { "state" : "new", - "value" : "Gesture Slide Distance" + "value" : "Gesture Sliding Distance" } }, "zh-Hans" : { diff --git a/VoidLink/mul.lproj/iPhone.xcstrings b/VoidLink/mul.lproj/iPhone.xcstrings index b009d3aa..b2aead3a 100644 --- a/VoidLink/mul.lproj/iPhone.xcstrings +++ b/VoidLink/mul.lproj/iPhone.xcstrings @@ -577,6 +577,36 @@ } } }, + "6PG-vr-boy.text" : { + "comment" : "Class = \"UILabel\"; text = \"Edge Trigger Sensitivity\"; ObjectID = \"6PG-vr-boy\";", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Edge Trigger Sensitivity" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "边缘触发灵敏度" + } + }, + "zh-Hant" : { + "stringUnit" : { + "state" : "translated", + "value" : "邊緣觸發靈敏度" + } + }, + "zh-HK" : { + "stringUnit" : { + "state" : "translated", + "value" : "邊緣觸發靈敏度" + } + } + } + }, "7nX-ra-hKS.text" : { "comment" : "Class = \"UILabel\"; text = \"HDR\"; ObjectID = \"7nX-ra-hKS\";", "extractionState" : "extracted_with_value",