From c094d74d8e6c55fdc78ac1b66819ff9f05abcc9d Mon Sep 17 00:00:00 2001 From: TrueZhuanjia Date: Thu, 11 Sep 2025 21:39:55 +0800 Subject: [PATCH] - feat: allow touchPad label to be display if it's different from touchPad cmdString --- VoidLink/Input/CustomOSC/OSCProfilesManager.m | 2 +- VoidLink/Input/OnScreenWidgetView.swift | 12 +++++++----- .../LayoutOnScreenControlsViewController.m | 4 ++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/VoidLink/Input/CustomOSC/OSCProfilesManager.m b/VoidLink/Input/CustomOSC/OSCProfilesManager.m index 116acd31..75411a81 100644 --- a/VoidLink/Input/CustomOSC/OSCProfilesManager.m +++ b/VoidLink/Input/CustomOSC/OSCProfilesManager.m @@ -373,7 +373,7 @@ static CGRect layoutViewBounds; for(OnScreenWidgetView* widgetView in OnScreenWidgetViews){ CGPoint normalizedPosition = [self normalizeWidgetPosition:widgetView.center]; OnScreenButtonState *buttonState = [[OnScreenButtonState alloc] initWithButtonName:widgetView.cmdString buttonType:CustomOnScreenWidget andPosition:normalizedPosition]; - buttonState.alias = widgetView.buttonLabel; + buttonState.alias = widgetView.widgetLabel; buttonState.widthFactor = [self normalizeSizeWidthFactor:widgetView]; NSLog(@"logging widthFactor %f", buttonState.widthFactor); buttonState.heightFactor = [self normalizeSizeHeightFactor:widgetView]; diff --git a/VoidLink/Input/OnScreenWidgetView.swift b/VoidLink/Input/OnScreenWidgetView.swift index be536be3..101e0608 100644 --- a/VoidLink/Input/OnScreenWidgetView.swift +++ b/VoidLink/Input/OnScreenWidgetView.swift @@ -35,7 +35,7 @@ import UIKit @objc static public var editMode: Bool = false @objc static public var buttonVisualFeedbackEnabled: Bool = true - @objc public var buttonLabel: String + @objc public var widgetLabel: String @objc public var cmdString: String private var buttonString: String = "" private var touchPadString: String = "" @@ -226,7 +226,7 @@ import UIKit print("comboButtonString: \(comboButtonString)") } - self.buttonLabel = buttonLabel + self.widgetLabel = buttonLabel self.shape = shape self.label = UILabel() // self.originalBackgroundColor = UIColor(white: 0.2, alpha: 0.7) @@ -457,7 +457,7 @@ import UIKit } private func setupView() { - label.text = self.buttonLabel + label.text = self.widgetLabel label.font = UIFont.boldSystemFont(ofSize: 19) label.translatesAutoresizingMaskIntoConstraints = false label.adjustsFontSizeToFitWidth = true @@ -489,9 +489,11 @@ import UIKit self.shape = "largeSquare" // override shape from user input if(self.borderWidth < 1) {self.layer.borderWidth = 1} else {self.layer.borderWidth = self.borderWidth} - label.text = "" // make touchPad display no text if OnScreenWidgetView.editMode { //display label in edit mode to make the pad more visible - label.text = self.buttonLabel + label.text = self.widgetLabel + } + else{ + label.isHidden = self.widgetLabel.uppercased() == self.touchPadString // allow touchPad label to be display if it's different from touchPad cmdString } } diff --git a/VoidLink/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.m b/VoidLink/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.m index 74236532..71d3a011 100644 --- a/VoidLink/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.m +++ b/VoidLink/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.m @@ -541,7 +541,7 @@ textField.keyboardType = UIKeyboardTypeASCIICapable; textField.autocorrectionType = UITextAutocorrectionTypeNo; textField.spellCheckingType = UITextSpellCheckingTypeNo; - textField.text = self->selectedWidgetView.buttonLabel; + textField.text = self->selectedWidgetView.widgetLabel; }]; [alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) { @@ -749,7 +749,7 @@ [self.currentProfileLabel setText: [LocalizationHelper localizedStringForKey:@" Profile: %@ Widget: %@", [profilesManager getSelectedProfile].name, - selectedWidgetView.buttonLabel]]; + selectedWidgetView.widgetLabel]]; self.undoButton.alpha = selectedWidgetView.layoutChanges.count>1 ? 1.0 : 0.3;