GUI command picker for toolbox menu

This commit is contained in:
True Zhuanjia
2026-04-16 17:31:49 +08:00
parent ecc7a79a8c
commit 9104a7b7b9
4 changed files with 77 additions and 66 deletions
+10 -3
View File
@@ -302,6 +302,7 @@ struct WidgetPickerView: View {
private let availableTabs: [WidgetPickerTab]
private let preferredInitialTab: WidgetPickerTab?
private let keyboardPickerMode: VirtualKeyboardMode
var shortcutPickerNeedAlias: Bool = false
private let shortcutPickerTipText: String?
private let shortcutIdentifier: String?
@ObservedObject private var presentationState: WidgetPickerPresentationState
@@ -348,6 +349,7 @@ struct WidgetPickerView: View {
availableTabs: [WidgetPickerTab] = WidgetPickerTab.allCases,
preferredInitialTab: WidgetPickerTab? = nil,
keyboardPickerMode: VirtualKeyboardMode = .picker,
shortcutPickerNeedAlias: Bool = false,
shortcutPickerTipText: String? = nil,
shortcutIdentififier: String? = nil,
presentationState: WidgetPickerPresentationState = WidgetPickerPresentationState(),
@@ -363,6 +365,7 @@ struct WidgetPickerView: View {
self.availableTabs = normalizedTabs
self.preferredInitialTab = resolvedInitialTab
self.keyboardPickerMode = keyboardPickerMode
self.shortcutPickerNeedAlias = shortcutPickerNeedAlias
self.shortcutPickerTipText = shortcutPickerTipText
self.shortcutIdentifier = shortcutIdentififier
self.presentationState = presentationState
@@ -1770,6 +1773,7 @@ struct WidgetPickerView: View {
}
private var showsComboModeControl: Bool {
if isShortcutPickerMode { return false }
guard targetWidgetKind == .button else { return false }
if let selectedFunctionalButtonOption {
return selectedFunctionalButtonOption.allowsSkillCombo || selectedFunctionalButtonOption.allowsShortcutCombo
@@ -1778,14 +1782,17 @@ struct WidgetPickerView: View {
}
private var showsShapeControl: Bool {
targetWidgetKind == .button
if isShortcutPickerMode { return false }
return targetWidgetKind == .button
}
private var showsButtonLabelField: Bool {
targetWidgetKind == .button
if isShortcutPickerMode { return shortcutPickerNeedAlias }
return targetWidgetKind == .button
}
private var showsIntervalSlider: Bool {
if isShortcutPickerMode { return false }
guard buttonCommandCount >= 2 else { return false }
if let selectedFunctionalButtonOption {
return selectedFunctionalButtonOption.allowsSkillCombo
@@ -1815,7 +1822,7 @@ struct WidgetPickerView: View {
private var shouldBypassCreateWidgetSheet: Bool {
if isShortcutPickerMode {
return true
// return true
}
if containsMovementDirectionPad {
@@ -26,6 +26,7 @@ public final class WidgetPickerViewController: UIViewController {
public var tabIdentifiers: [String] = []
public var initialTabIdentifier: String?
public var keyboardPickerMode: VirtualKeyboardMode = .picker
var shortcutPickerNeedAlias: Bool = false
public var shortcutPickerTipText: String?
@objc public var shortcutIdentifier: String?
@@ -45,6 +46,7 @@ public final class WidgetPickerViewController: UIViewController {
availableTabs: resolvedTabs(),
preferredInitialTab: resolvedInitialTab(),
keyboardPickerMode: keyboardPickerMode,
shortcutPickerNeedAlias: shortcutPickerNeedAlias,
shortcutPickerTipText: shortcutPickerTipText,
shortcutIdentififier: shortcutIdentifier,
presentationState: presentationState,