autoDock & toolbox gesture fixes

This commit is contained in:
True Zhuanjia
2026-04-10 17:05:04 +08:00
parent bb63183a51
commit a0d1982a14
6 changed files with 15 additions and 3 deletions
@@ -3,6 +3,6 @@
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key> <key>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key>
<false/> <true/>
</dict> </dict>
</plist> </plist>
+3
View File
@@ -132,6 +132,9 @@ import UIKit
@objc public static let functionalButtonCmds: [String] = [ @objc public static let functionalButtonCmds: [String] = [
"SETTINGS", "SETTINGS",
"TOOLBOX", "TOOLBOX",
"DISCONNECT",
"QUITAPP",
"PIP",
"WIDGETTOOL", "WIDGETTOOL",
"ABSGAMEPAD", "ABSGAMEPAD",
"WIDGETPROFILES", "WIDGETPROFILES",
+7
View File
@@ -18,6 +18,7 @@ import ObjectiveC.runtime
@objc public static var mapping: [Int16:OnScreenWidgetView] = [:] @objc public static var mapping: [Int16:OnScreenWidgetView] = [:]
@objc public static var isRestoring: Bool = false @objc public static var isRestoring: Bool = false
@objc public static var hasRestoredFromAutoDock: Bool = false
@objc public static func set(widget:OnScreenWidgetView, for key:Int16) { @objc public static func set(widget:OnScreenWidgetView, for key:Int16) {
mapping[key] = widget mapping[key] = widget
} }
@@ -3017,6 +3018,11 @@ import ObjectiveC.runtime
@objc private func vl_autoDock_touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) { @objc private func vl_autoDock_touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
OnScreenWidgetView.autoDockOriginalTouchesEndedIMP?(self, #selector(OnScreenWidgetView.touchesEnded(_:with:)), touches, event) OnScreenWidgetView.autoDockOriginalTouchesEndedIMP?(self, #selector(OnScreenWidgetView.touchesEnded(_:with:)), touches, event)
guard autoDockEnabled else { return } guard autoDockEnabled else { return }
if OnScreenWidgetView.hasRestoredFromAutoDock {
DispatchQueue.global().asyncAfter(deadline: .now() + 0.02){
OnScreenWidgetView.hasRestoredFromAutoDock = false
}
}
autoDockRestartCountdownIfNeeded() autoDockRestartCountdownIfNeeded()
} }
@@ -3194,6 +3200,7 @@ import ObjectiveC.runtime
private func autoDockRestoreWidget(animated: Bool) { private func autoDockRestoreWidget(animated: Bool) {
guard autoDockIsDocked, let restoreCenter = autoDockStoredCenter else { return } guard autoDockIsDocked, let restoreCenter = autoDockStoredCenter else { return }
OnScreenWidgetView.hasRestoredFromAutoDock = true
autoDockStopCountdown() autoDockStopCountdown()
autoDockStopSettledAlphaTimer() autoDockStopSettledAlphaTimer()
autoDockRestoreOriginalSize() autoDockRestoreOriginalSize()
@@ -10,6 +10,7 @@
#import "CustomEdgeSlideGestureRecognizer.h" #import "CustomEdgeSlideGestureRecognizer.h"
#import <UIKit/UIGestureRecognizerSubclass.h> #import <UIKit/UIGestureRecognizerSubclass.h>
#import "VoidLink-Swift.h"
@implementation CustomEdgeSlideGestureRecognizer @implementation CustomEdgeSlideGestureRecognizer
UITouch* capturedUITouch; UITouch* capturedUITouch;
@@ -52,6 +53,7 @@ CGFloat startPointX;
- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event { - (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
// [super touchesEnded:touches withEvent:event]; // [super touchesEnded:touches withEvent:event];
if(_excludePencilEvent && touches.anyObject.type != UITouchTypeDirect) return; if(_excludePencilEvent && touches.anyObject.type != UITouchTypeDirect) return;
if(OnScreenWidgetView.hasRestoredFromAutoDock) return;
if([touches containsObject:capturedUITouch]){ if([touches containsObject:capturedUITouch]){
CGFloat _endPointX = [capturedUITouch locationInView:self.view].x; CGFloat _endPointX = [capturedUITouch locationInView:self.view].x;
CGFloat screenWidthInPoints = self.view.frame.size.width; CGFloat screenWidthInPoints = self.view.frame.size.width;
@@ -900,7 +900,7 @@ BOOL isCustomResolution(int resolutionSelected) {
[self addSetting:self.softKeyboardGestureStack ofId:@"softKeyboardGestureStack" withInfoTag:YES withDynamicLabel:NO to:gesturesSection]; [self addSetting:self.softKeyboardGestureStack ofId:@"softKeyboardGestureStack" withInfoTag:YES withDynamicLabel:NO to:gesturesSection];
[self addSetting:self.slideToSettingsScreenEdgeStack ofId:@"slideToSettingsScreenEdgeStack" withInfoTag:NO withDynamicLabel:NO to:gesturesSection]; [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.slideToToolboxScreenEdgeStack ofId:@"slideToToolboxScreenEdgeStack" withInfoTag:NO withDynamicLabel:NO to:gesturesSection];
[self addSetting:self.slideToSettingsDistanceStack ofId:@"slideToSettingsDistanceStack" withInfoTag:YES withDynamicLabel:YES 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]; [self addSetting:self.edgeSlidingSensitivityStack ofId:@"edgeSlidingSensitivityStack" withInfoTag:YES withDynamicLabel:YES to:gesturesSection];
[gesturesSection addToParentStack:_parentStack]; [gesturesSection addToParentStack:_parentStack];
@@ -298,7 +298,7 @@
_slideToToolboxRecognizer.normalizedThresholdDistance = _settings.slideToSettingsDistance.floatValue; _slideToToolboxRecognizer.normalizedThresholdDistance = _settings.slideToSettingsDistance.floatValue;
_slideToToolboxRecognizer.delaysTouchesBegan = NO; _slideToToolboxRecognizer.delaysTouchesBegan = NO;
_slideToToolboxRecognizer.delaysTouchesEnded = NO; _slideToToolboxRecognizer.delaysTouchesEnded = NO;
// [self.view addGestureRecognizer:_slideToToolboxRecognizer]; [self.view addGestureRecognizer:_slideToToolboxRecognizer];
if([self isOscLayoutToolEnabled]){ if([self isOscLayoutToolEnabled]){
_oscLayoutTapRecoginizer = [[CustomTapGestureRecognizer alloc] initWithTarget:self action:@selector(handleWidgetLayoutGesture)]; _oscLayoutTapRecoginizer = [[CustomTapGestureRecognizer alloc] initWithTarget:self action:@selector(handleWidgetLayoutGesture)];