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

This commit is contained in:
TrueZhuanjia committed 2025-09-11 21:39:55 +08:00
1 parent 5418936816
commit c094d74d8e
3 files changed
+10 -8

No files matched your search

@@ -373,7 +373,7 @@ static CGRect layoutViewBounds;
for(OnScreenWidgetView* widgetView in OnScreenWidgetViews){ for(OnScreenWidgetView* widgetView in OnScreenWidgetViews){
CGPoint normalizedPosition = [self normalizeWidgetPosition:widgetView.center]; CGPoint normalizedPosition = [self normalizeWidgetPosition:widgetView.center];
OnScreenButtonState *buttonState = [[OnScreenButtonState alloc] initWithButtonName:widgetView.cmdString buttonType:CustomOnScreenWidget andPosition:normalizedPosition]; OnScreenButtonState *buttonState = [[OnScreenButtonState alloc] initWithButtonName:widgetView.cmdString buttonType:CustomOnScreenWidget andPosition:normalizedPosition];
buttonState.alias = widgetView.buttonLabel; buttonState.alias = widgetView.widgetLabel;
buttonState.widthFactor = [self normalizeSizeWidthFactor:widgetView]; buttonState.widthFactor = [self normalizeSizeWidthFactor:widgetView];
NSLog(@"logging widthFactor %f", buttonState.widthFactor); NSLog(@"logging widthFactor %f", buttonState.widthFactor);
buttonState.heightFactor = [self normalizeSizeHeightFactor:widgetView]; 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 editMode: Bool = false
@objc static public var buttonVisualFeedbackEnabled: Bool = true @objc static public var buttonVisualFeedbackEnabled: Bool = true
@objc public var buttonLabel: String @objc public var widgetLabel: String
@objc public var cmdString: String @objc public var cmdString: String
private var buttonString: String = "" private var buttonString: String = ""
private var touchPadString: String = "" private var touchPadString: String = ""
@@ -226,7 +226,7 @@ import UIKit
print("comboButtonString: \(comboButtonString)") print("comboButtonString: \(comboButtonString)")
} }
self.buttonLabel = buttonLabel self.widgetLabel = buttonLabel
self.shape = shape self.shape = shape
self.label = UILabel() self.label = UILabel()
// self.originalBackgroundColor = UIColor(white: 0.2, alpha: 0.7) // self.originalBackgroundColor = UIColor(white: 0.2, alpha: 0.7)
@@ -457,7 +457,7 @@ import UIKit
} }
private func setupView() { private func setupView() {
label.text = self.buttonLabel label.text = self.widgetLabel
label.font = UIFont.boldSystemFont(ofSize: 19) label.font = UIFont.boldSystemFont(ofSize: 19)
label.translatesAutoresizingMaskIntoConstraints = false label.translatesAutoresizingMaskIntoConstraints = false
label.adjustsFontSizeToFitWidth = true label.adjustsFontSizeToFitWidth = true
@@ -489,9 +489,11 @@ import UIKit
self.shape = "largeSquare" // override shape from user input self.shape = "largeSquare" // override shape from user input
if(self.borderWidth < 1) {self.layer.borderWidth = 1} if(self.borderWidth < 1) {self.layer.borderWidth = 1}
else {self.layer.borderWidth = self.borderWidth} 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 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.keyboardType = UIKeyboardTypeASCIICapable;
textField.autocorrectionType = UITextAutocorrectionTypeNo; textField.autocorrectionType = UITextAutocorrectionTypeNo;
textField.spellCheckingType = UITextSpellCheckingTypeNo; textField.spellCheckingType = UITextSpellCheckingTypeNo;
textField.text = self->selectedWidgetView.buttonLabel; textField.text = self->selectedWidgetView.widgetLabel;
}]; }];
[alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) { [alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) {
@@ -749,7 +749,7 @@
[self.currentProfileLabel setText: [self.currentProfileLabel setText:
[LocalizationHelper localizedStringForKey:@" Profile: %@ Widget: %@", [LocalizationHelper localizedStringForKey:@" Profile: %@ Widget: %@",
[profilesManager getSelectedProfile].name, [profilesManager getSelectedProfile].name,
selectedWidgetView.buttonLabel]]; selectedWidgetView.widgetLabel]];
self.undoButton.alpha = selectedWidgetView.layoutChanges.count>1 ? 1.0 : 0.3; self.undoButton.alpha = selectedWidgetView.layoutChanges.count>1 ? 1.0 : 0.3;