widget layout tool minor improvements

This commit is contained in:
True Zhuanjia committed 2026-05-12 20:46:28 +08:00
1 parent c734030e87
commit 4195f97d56
2 files changed
+9 -3

No files matched your search

+7 -1
View File
@@ -557,7 +557,7 @@ import ObjectiveC.runtime
} }
} }
if self.widgetType == WidgetTypeEnum.touchPad { if self.widgetType == .touchPad {
if self.isStickWheel { if self.isStickWheel {
self.widthFactor = 2 self.widthFactor = 2
self.heightFactor = 2.6 self.heightFactor = 2.6
@@ -587,6 +587,12 @@ import ObjectiveC.runtime
self.sensitivityFactorY = 0 self.sensitivityFactorY = 0
} }
} }
if self.widgetType == .button {
if self.isFolder {
self.widthFactor = 1.17
self.heightFactor = 0.77
}
}
self.tweakBorderAlpha(alpha: self.borderAlpha) // fix default borderAlpha offset self.tweakBorderAlpha(alpha: self.borderAlpha) // fix default borderAlpha offset
@@ -1237,7 +1237,6 @@ final class LayoutOnScreenControlsViewController: UIViewController, OnScreenWidg
newWidget.setVibration(style: Int(widget.vibrationStyle)) newWidget.setVibration(style: Int(widget.vibrationStyle))
newWidget.mouseButtonAction = widget.mouseButtonAction newWidget.mouseButtonAction = widget.mouseButtonAction
newWidget.animatesTransition = widget.animatesTransition newWidget.animatesTransition = widget.animatesTransition
newWidget.buttonMode = widget.buttonMode
newWidget.sprintKeyActionType = widget.sprintKeyActionType newWidget.sprintKeyActionType = widget.sprintKeyActionType
newWidget.sprintKeyThreshold = widget.sprintKeyThreshold newWidget.sprintKeyThreshold = widget.sprintKeyThreshold
newWidget.walkKeyActionType = widget.walkKeyActionType newWidget.walkKeyActionType = widget.walkKeyActionType
@@ -1246,6 +1245,7 @@ final class LayoutOnScreenControlsViewController: UIViewController, OnScreenWidg
guard newWidget.widgetType == widget.widgetType else { return } guard newWidget.widgetType == widget.widgetType else { return }
view.insertSubview(newWidget, belowSubview: widgetPanelStack) view.insertSubview(newWidget, belowSubview: widgetPanelStack)
newWidget.accessWidgetAttributes() newWidget.accessWidgetAttributes()
newWidget.buttonMode = (newWidget.widgetType == .button && newWidget.touchPadString != "") ? .regular : widget.buttonMode
newWidget.sensitivityFactorX = widget.sensitivityFactorX newWidget.sensitivityFactorX = widget.sensitivityFactorX
newWidget.componentSizeFactor = widget.componentSizeFactor newWidget.componentSizeFactor = widget.componentSizeFactor
newWidget.touchPointAnchored = widget.touchPointAnchored newWidget.touchPointAnchored = widget.touchPointAnchored
@@ -1934,7 +1934,7 @@ final class LayoutOnScreenControlsViewController: UIViewController, OnScreenWidg
selectedWidgetView.translatesAutoresizingMaskIntoConstraints = true selectedWidgetView.translatesAutoresizingMaskIntoConstraints = true
let aspectRatio = selectedWidgetView.heightFactor / selectedWidgetView.widthFactor let aspectRatio = selectedWidgetView.heightFactor / selectedWidgetView.widthFactor
selectedWidgetView.widthFactor = CGFloat(sender.value) selectedWidgetView.widthFactor = CGFloat(sender.value)
selectedWidgetView.heightFactor = selectedWidgetView.widthFactor * aspectRatio selectedWidgetView.heightFactor = min(max(CGFloat(sender.minimumValue), selectedWidgetView.widthFactor * aspectRatio), CGFloat(sender.maximumValue))
widgetSizeLabel.text = LocalizationHelper.localizedString(forKey: "Size: %.2f", sender.value) widgetSizeLabel.text = LocalizationHelper.localizedString(forKey: "Size: %.2f", sender.value)
widgetHeightLabel.text = LocalizationHelper.localizedString(forKey: "Height: %.2f", selectedWidgetView.heightFactor) widgetHeightLabel.text = LocalizationHelper.localizedString(forKey: "Height: %.2f", selectedWidgetView.heightFactor)
widgetHeightSlider.value = Float(selectedWidgetView.heightFactor) widgetHeightSlider.value = Float(selectedWidgetView.heightFactor)