- feat: allow touchPad label to be display if it's different from touchPad cmdString

This commit is contained in:
TrueZhuanjia
2025-09-11 21:39:55 +08:00
parent 5418936816
commit c094d74d8e
3 changed files with 10 additions and 8 deletions
@@ -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];
+7 -5
View File
@@ -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
}
}
@@ -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;