From d092b93a29d031634889461356bdb512b8853107 Mon Sep 17 00:00:00 2001 From: True Zhuanjia Date: Sun, 22 Mar 2026 11:21:51 +0800 Subject: [PATCH] - allow wider size range for on-screen widgets - minor improvements --- VoidLink/Base.lproj/iPad.storyboard | 4 +- VoidLink/Base.lproj/iPhone.storyboard | 4 +- .../Input/CustomOSC/LayoutOnScreenControls.m | 4 +- VoidLink/Input/OnScreenWidgetView.swift | 27 ++++++---- VoidLink/Localization/Localizable.xcstrings | 52 +++++++++++-------- .../ViewControllers/SettingsViewController.m | 2 +- 6 files changed, 53 insertions(+), 40 deletions(-) diff --git a/VoidLink/Base.lproj/iPad.storyboard b/VoidLink/Base.lproj/iPad.storyboard index b27b0c1c..5fece34b 100644 --- a/VoidLink/Base.lproj/iPad.storyboard +++ b/VoidLink/Base.lproj/iPad.storyboard @@ -2694,7 +2694,7 @@ - + @@ -2713,7 +2713,7 @@ - + diff --git a/VoidLink/Base.lproj/iPhone.storyboard b/VoidLink/Base.lproj/iPhone.storyboard index 71075aa3..38f15791 100644 --- a/VoidLink/Base.lproj/iPhone.storyboard +++ b/VoidLink/Base.lproj/iPhone.storyboard @@ -386,7 +386,7 @@ - + @@ -408,7 +408,7 @@ - + diff --git a/VoidLink/Input/CustomOSC/LayoutOnScreenControls.m b/VoidLink/Input/CustomOSC/LayoutOnScreenControls.m index b327f22d..532b6183 100644 --- a/VoidLink/Input/CustomOSC/LayoutOnScreenControls.m +++ b/VoidLink/Input/CustomOSC/LayoutOnScreenControls.m @@ -149,7 +149,9 @@ } for(UIView* view in self.layoutToolVC.view.subviews){ if ([view isKindOfClass:[OnScreenWidgetView class]] && view != widget) { - if ((horizontalGuideline.center.y < view.center.y + 1) && (horizontalGuideline.center.y > view.center.y - 1)) { + OnScreenWidgetView* otherWidget = (OnScreenWidgetView *) view; + if(widget.isFolder && widget.bulkMoveEnabled && [widget.sequenceSet containsObject:@(otherWidget.sequence)]) break; + if((horizontalGuideline.center.y < view.center.y + 1) && (horizontalGuideline.center.y > view.center.y - 1)) { horizontalGuideline.backgroundColor = [UIColor yellowColor]; break; } diff --git a/VoidLink/Input/OnScreenWidgetView.swift b/VoidLink/Input/OnScreenWidgetView.swift index cca1164b..a73084cb 100644 --- a/VoidLink/Input/OnScreenWidgetView.swift +++ b/VoidLink/Input/OnScreenWidgetView.swift @@ -697,13 +697,13 @@ import SVGKit private func getDiameter(lengthFactor:CGFloat) -> CGFloat { self.getBaselineLenths() - let isNormalizedSizeFactor = lengthFactor > 6; + let isNormalizedSizeFactor = lengthFactor > 10; return isNormalizedSizeFactor ? denormalizeSize(sizeFactor:lengthFactor) : CGFloat(Int(baselineDiameter * lengthFactor / 2) * 2) } private func getRecSize(widthFactor:CGFloat, heightFactor:CGFloat) -> CGSize { - let isNormalizedSizeFactor = widthFactor > 6; - let isNormalizedHeightFactor = heightFactor > 6; + let isNormalizedSizeFactor = widthFactor > 10; + let isNormalizedHeightFactor = heightFactor > 10; self.getBaselineLenths() @@ -2853,7 +2853,7 @@ import SVGKit } } - private func highlightBorder(highlighted:Bool) { + private func highlightBorder(highlighted:Bool, color:CGColor? = nil) { if self.isFolder { OnScreenWidgetView.setBorder(hilighted: highlighted, in: UIColor.systemYellow.cgColor, for: self) self.forEachWidget{ widget in @@ -2864,7 +2864,7 @@ import SVGKit return } - OnScreenWidgetView.setBorder(hilighted: highlighted, in: voidlinkPurple, for: self) + OnScreenWidgetView.setBorder(hilighted: highlighted, in: color ?? voidlinkPurple, for: self) } private func isPencilProEnabled() -> Bool { @@ -2906,8 +2906,9 @@ import SVGKit guard let widget = OnScreenWidgetView.mapping[sequence], widget != exception else {continue} DispatchQueue.main.async { widget.isUserInteractionEnabled = false - if widget.widgetType == .touchPad { - widget.highlightBorder(highlighted: true) + if ((folder.buttonMode != .slideAndHold && widget.widgetType == .touchPad) + || abs(widget.backgroundAlpha) < 0.1){ + widget.highlightBorder(highlighted: true, color: UIColor.systemBlue.cgColor) } let duration = OnScreenWidgetView.enableFolderAnimation ? (folder.buttonMode == .slideAndHold ? 0.05 : 0.15) : 0 UIView.animate(withDuration: duration, animations: { @@ -2916,7 +2917,8 @@ import SVGKit widget.isUserInteractionEnabled = !hidden widget.center = folder.folded ? folder.storedCenter : widget.storedCenter widget.isHidden = folder.folded - if widget.widgetType == .touchPad { + if ((folder.buttonMode != .slideAndHold && widget.widgetType == .touchPad) + || abs(widget.backgroundAlpha) < 0.1){ widget.highlightBorder(highlighted: false) } }) @@ -2931,8 +2933,9 @@ import SVGKit widget.capturedTouches.removeAllObjects() widget.center = folder.storedCenter widget.isHidden = false - if widget.widgetType == .touchPad { - widget.highlightBorder(highlighted: true) + if ((folder.buttonMode != .slideAndHold && widget.widgetType == .touchPad) + || abs(widget.backgroundAlpha) < 0.1){ + widget.highlightBorder(highlighted: true, color: UIColor.systemBlue.cgColor) } UIView.animate(withDuration: OnScreenWidgetView.enableFolderAnimation ? (folder.buttonMode == .slideAndHold ? 0.05 : 0.15) : 0, animations: { widget.center = widget.storedCenter @@ -2941,7 +2944,8 @@ import SVGKit widget.isUserInteractionEnabled = !folder.folded widget.center = folder.folded ? folder.storedCenter : widget.storedCenter widget.isHidden = folder.folded - if widget.widgetType == .touchPad { + if ((folder.buttonMode != .slideAndHold && widget.widgetType == .touchPad) + || abs(widget.backgroundAlpha) < 0.1){ widget.highlightBorder(highlighted: false) } }) @@ -3151,6 +3155,7 @@ import SVGKit var verticallyAligned = false widget.forEachWidget{ otherWidget in guard otherWidget != widget else {return} + if widget.isFolder, widget.bulkMoveEnabled, widget.sequenceSet.contains(otherWidget.sequence) {return} verticallyAligned = verticallyAligned ? verticallyAligned : widget.center.x > otherWidget.center.x-1 && widget.center.x < otherWidget.center.x+1 horizontallyAligned = horizontallyAligned ? horizontallyAligned : widget.center.y > otherWidget.center.y-1 && widget.center.y < otherWidget.center.y+1 } diff --git a/VoidLink/Localization/Localizable.xcstrings b/VoidLink/Localization/Localizable.xcstrings index 62f537e7..92e9273e 100644 --- a/VoidLink/Localization/Localizable.xcstrings +++ b/VoidLink/Localization/Localizable.xcstrings @@ -5024,6 +5024,35 @@ } } }, + "mouseModeSwitchButtonTip" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Press a button for switching to controller mouse mode (long press for 1 second during streaming)\n\nNote: if you want to designate home button, double tap to pass it through to VoidLink app on iOS 26+." + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "按下用于切换手柄鼠标模式的按键(串流时长按1秒切换)\n\n注意:如果需要指定 home 键,在 iOS 26+ 系统上需要双击将该按键透传至 VoidLink。" + } + }, + "zh-Hant" : { + "stringUnit" : { + "state" : "translated", + "value" : "按下用於切換手柄滑鼠模式的按鍵(串流時長按 1 秒切換)\n\n注意:如果需要指定 Home 鍵,在 iOS 26+ 系統上需要雙擊將該按鍵透傳至 VoidLink。" + } + }, + "zh-HK" : { + "stringUnit" : { + "state" : "translated", + "value" : "按下用於切換手柄滑鼠模式的按鍵(串流時長按 1 秒切換)。\n\n注意:如果需要指定 Home 鍵,在 iOS 26+ 系統上需要雙擊將該按鍵透傳至 VoidLink。" + } + } + } + }, "Move the stick you wish to use for mouse control. Another stick will be used for vertical & horizontal scroll." : { "extractionState" : "manual", "localizations" : { @@ -6486,29 +6515,6 @@ } } }, - "Press a button for switching to controller mouse mode (long press for 1 second during streaming)" : { - "extractionState" : "manual", - "localizations" : { - "zh-Hans" : { - "stringUnit" : { - "state" : "translated", - "value" : "按下用于切换手柄鼠标模式的按键(串流时长按1秒切换)" - } - }, - "zh-Hant" : { - "stringUnit" : { - "state" : "translated", - "value" : "按下用於切換手柄滑鼠模式的按鍵(串流時長按 1 秒切換)" - } - }, - "zh-HK" : { - "stringUnit" : { - "state" : "translated", - "value" : "按下用於切換手柄滑鼠模式的按鍵(串流時長按 1 秒切換)" - } - } - } - }, "Press the button for mouse left button" : { "extractionState" : "manual", "localizations" : { diff --git a/VoidLink/ViewControllers/SettingsViewController.m b/VoidLink/ViewControllers/SettingsViewController.m index 94772cde..36466df3 100644 --- a/VoidLink/ViewControllers/SettingsViewController.m +++ b/VoidLink/ViewControllers/SettingsViewController.m @@ -2592,7 +2592,7 @@ BOOL isCustomResolution(int resolutionSelected) { Settings* currentSettings = [dataMan retrieveSettings]; [AlertControllerUtil showAlertIn:self title:[LocalizationHelper localizedStringForKey:@"Map controller to mouse"] - message:[LocalizationHelper localizedStringForKey:@"Press a button for switching to controller mouse mode (long press for 1 second during streaming)"] + message:[LocalizationHelper localizedStringForKey:@"mouseModeSwitchButtonTip"] withCancel:YES buttonTitle:@"" countdown:0