From 96d997d41ea281c3f1774bb17e2ba0b6ce2c6c64 Mon Sep 17 00:00:00 2001 From: True Zhuanjia Date: Tue, 12 May 2026 17:09:14 +0800 Subject: [PATCH] button widget batch resize --- VoidLink/Base.lproj/iPad.storyboard | 72 ++++++++++++++++--- VoidLink/Base.lproj/iPhone.storyboard | 72 ++++++++++++++++--- VoidLink/Localization/Localizable.xcstrings | 46 ++++++++++++ ...LayoutOnScreenControlsViewController.swift | 55 ++++++++++++-- VoidLink/mul.lproj/iPad.xcstrings | 24 +++++++ VoidLink/mul.lproj/iPhone.xcstrings | 24 +++++++ 6 files changed, 267 insertions(+), 26 deletions(-) diff --git a/VoidLink/Base.lproj/iPad.storyboard b/VoidLink/Base.lproj/iPad.storyboard index b81916f9..6ea990de 100644 --- a/VoidLink/Base.lproj/iPad.storyboard +++ b/VoidLink/Base.lproj/iPad.storyboard @@ -2699,7 +2699,7 @@ - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + @@ -3686,6 +3730,9 @@ + + + @@ -3697,6 +3744,9 @@ + + + diff --git a/VoidLink/Base.lproj/iPhone.storyboard b/VoidLink/Base.lproj/iPhone.storyboard index 59876238..30336335 100644 --- a/VoidLink/Base.lproj/iPhone.storyboard +++ b/VoidLink/Base.lproj/iPhone.storyboard @@ -302,7 +302,7 @@ - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + @@ -1345,6 +1389,9 @@ + + + @@ -1356,6 +1403,9 @@ + + + diff --git a/VoidLink/Localization/Localizable.xcstrings b/VoidLink/Localization/Localizable.xcstrings index 9c40d122..0bdd968b 100644 --- a/VoidLink/Localization/Localizable.xcstrings +++ b/VoidLink/Localization/Localizable.xcstrings @@ -13943,6 +13943,52 @@ } } }, + "Width" : { + "extractionState" : "manual", + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "宽度" + } + }, + "zh-Hant" : { + "stringUnit" : { + "state" : "translated", + "value" : "寬度" + } + }, + "zh-HK" : { + "stringUnit" : { + "state" : "translated", + "value" : "寬度" + } + } + } + }, + "Width: %.2f" : { + "extractionState" : "manual", + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "宽度: %.2f" + } + }, + "zh-Hant" : { + "stringUnit" : { + "state" : "translated", + "value" : "寬度: %.2f" + } + }, + "zh-HK" : { + "stringUnit" : { + "state" : "translated", + "value" : "寬度: %.2f" + } + } + } + }, "X1" : { "extractionState" : "manual", "localizations" : { diff --git a/VoidLink/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.swift b/VoidLink/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.swift index a43dfea9..2ebe620d 100644 --- a/VoidLink/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.swift +++ b/VoidLink/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.swift @@ -127,6 +127,13 @@ final class LayoutOnScreenControlsViewController: UIViewController, OnScreenWidg private var bulkEditStacks: [UIStackView]? = [] private var preBulkEditStacks: [UIStackView] = [] + @IBOutlet weak var bulkWidthStack: UIStackView! + @IBOutlet weak var bulkWidthLabel: UILabel! + @IBOutlet weak var bulkWidthSlider: UISlider! + + @IBOutlet weak var bulkHeightStack: UIStackView! + @IBOutlet weak var bulkHeightLabel: UILabel! + @IBOutlet weak var bulkHeightSlider: UISlider! @IBOutlet weak var bulkAlphaStack: UIStackView! @IBOutlet weak var bulkAlphaLabel: UILabel! @@ -290,7 +297,7 @@ final class LayoutOnScreenControlsViewController: UIViewController, OnScreenWidg override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) - bulkEditStacks = [bulkAlphaStack, bulkBorderAlphaStack, bulkLabelAlphaStack, bulkBorderWidthStack, bulkHighlightAlphaStack, bulkHighlightSizeStack] + bulkEditStacks = [bulkWidthStack, bulkHeightStack, bulkAlphaStack, bulkBorderAlphaStack, bulkLabelAlphaStack, bulkBorderWidthStack, bulkHighlightAlphaStack, bulkHighlightSizeStack] bulkEditEnabled = false OnScreenWidgetView.editMode = true selectedWidgetView = nil @@ -1830,14 +1837,18 @@ final class LayoutOnScreenControlsViewController: UIViewController, OnScreenWidg applyTitle("Import", for: importFromOtherButton) applyTitle("Batch edit", for: bulkEditButton, state: .normal) + bulkWidthSlider.addTarget(self, action: #selector(bulkWidthSliderMoved(_:)), for: .valueChanged) + bulkWidthLabel.text = LocalizationHelper.localizedString(forKey: "Width") - - bulkBorderWidthSlider.addTarget(self, action: #selector(bulkBorderWidthSliderMoved(_:)), for: .valueChanged) - bulkBorderWidthLabel.text = LocalizationHelper.localizedString(forKey: "Border width") + bulkHeightSlider.addTarget(self, action: #selector(bulkHeightSliderMoved(_:)), for: .valueChanged) + bulkHeightLabel.text = LocalizationHelper.localizedString(forKey: "Height") bulkAlphaSlider.addTarget(self, action: #selector(bulkAlphaSliderMoved(_:)), for: .valueChanged) bulkAlphaLabel.text = LocalizationHelper.localizedString(forKey: "Alpha") + bulkBorderWidthSlider.addTarget(self, action: #selector(bulkBorderWidthSliderMoved(_:)), for: .valueChanged) + bulkBorderWidthLabel.text = LocalizationHelper.localizedString(forKey: "Border width") + bulkLabelAlphaSlider.addTarget(self, action: #selector(bulkLabelAlphaSliderMoved(_:)), for: .valueChanged) bulkLabelAlphaLabel.text = LocalizationHelper.localizedString(forKey: "Label alpha") @@ -2006,6 +2017,42 @@ final class LayoutOnScreenControlsViewController: UIViewController, OnScreenWidg } } + @objc private func bulkWidthSliderMoved(_ sender: UISlider) { + guard let selectedWidget = selectedWidgetView else {return} + bulkWidthLabel.text = LocalizationHelper.localizedString(forKey: "Width: %.2f", sender.value) + if selectedWidget.isFolder { + for sequence in selectedWidget.sequenceSet { + let widget = OnScreenWidgetView.mapping[sequence]; + if widget?.widgetType == .touchPad { continue } + widget?.widthFactor = CGFloat(sender.value) + } + } + else if selectedWidget.parentSequence == -1 { + for widget in OnScreenWidgetView.mapping.values where widget.parentSequence == -1 { + if widget.widgetType == .touchPad { continue } + widget.widthFactor = CGFloat(sender.value) + } + } + } + + @objc private func bulkHeightSliderMoved(_ sender: UISlider) { + guard let selectedWidget = selectedWidgetView else {return} + bulkHeightLabel.text = LocalizationHelper.localizedString(forKey: "Height: %.2f", sender.value) + if selectedWidget.isFolder { + for sequence in selectedWidget.sequenceSet { + let widget = OnScreenWidgetView.mapping[sequence]; + if widget?.widgetType == .touchPad { continue } + widget?.heightFactor = CGFloat(sender.value) + } + } + else if selectedWidget.parentSequence == -1 { + for widget in OnScreenWidgetView.mapping.values where widget.parentSequence == -1 { + if widget.widgetType == .touchPad { continue } + widget.heightFactor = CGFloat(sender.value) + } + } + } + @objc private func bulkAlphaSliderMoved(_ sender: UISlider) { guard let selectedWidget = selectedWidgetView else {return} bulkAlphaLabel.text = LocalizationHelper.localizedString(forKey: "Alpha: %.2f", sender.value) diff --git a/VoidLink/mul.lproj/iPad.xcstrings b/VoidLink/mul.lproj/iPad.xcstrings index e30db507..3dcdac84 100644 --- a/VoidLink/mul.lproj/iPad.xcstrings +++ b/VoidLink/mul.lproj/iPad.xcstrings @@ -2545,6 +2545,18 @@ } } }, + "D7h-Kq-SRP.text" : { + "comment" : "Class = \"UILabel\"; text = \"Width\"; ObjectID = \"D7h-Kq-SRP\";", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Width" + } + } + } + }, "dfj-BB-Vby.text" : { "comment" : "Class = \"UILabel\"; text = \"Passthrough Gestures\"; ObjectID = \"dfj-BB-Vby\";", "extractionState" : "extracted_with_value", @@ -6442,6 +6454,18 @@ } } }, + "V1y-Wk-uHM.text" : { + "comment" : "Class = \"UILabel\"; text = \"Height\"; ObjectID = \"V1y-Wk-uHM\";", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Height" + } + } + } + }, "v4J-ot-qpz.text" : { "comment" : "Class = \"UILabel\"; text = \"Slide threshold\"; ObjectID = \"v4J-ot-qpz\";", "extractionState" : "extracted_with_value", diff --git a/VoidLink/mul.lproj/iPhone.xcstrings b/VoidLink/mul.lproj/iPhone.xcstrings index 657f3d5a..b3bb44a4 100644 --- a/VoidLink/mul.lproj/iPhone.xcstrings +++ b/VoidLink/mul.lproj/iPhone.xcstrings @@ -1963,6 +1963,18 @@ } } }, + "cPX-zb-vAO.text" : { + "comment" : "Class = \"UILabel\"; text = \"Height\"; ObjectID = \"cPX-zb-vAO\";", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Height" + } + } + } + }, "cSB-7c-iRt.text" : { "comment" : "Class = \"UILabel\"; text = \" \"; ObjectID = \"cSB-7c-iRt\";", "extractionState" : "extracted_with_value", @@ -3385,6 +3397,18 @@ } } }, + "lhL-an-uDS.text" : { + "comment" : "Class = \"UILabel\"; text = \"Width\"; ObjectID = \"lhL-an-uDS\";", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Width" + } + } + } + }, "lJx-Tn-7we.text" : { "comment" : "Class = \"UILabel\"; text = \"Sprint key\"; ObjectID = \"lJx-Tn-7we\";", "extractionState" : "extracted_with_value",