- button widget skill combo enhanced to macro
- widget picker view UI fixes
This commit is contained in:
1 parent
a7088c70e5
commit
2c2088e4b1
11 files changed
+2057
-312
No files matched your search
@@ -399,6 +399,14 @@ struct AbstractGamepadView: View {
|
||||
|
||||
private func toggle(_ target: GamepadToggleTarget) {
|
||||
if activeButtons.contains(target) {
|
||||
if target.widgets.count == 1, let widget = target.widgets.first {
|
||||
if canSelectCommand?(widget.cmd) == false {
|
||||
return
|
||||
}
|
||||
AbstractGamepadView.selectedCmd = widget.cmd
|
||||
onCommandSelected?(widget.cmd)
|
||||
return
|
||||
}
|
||||
activeButtons.remove(target)
|
||||
for widget in target.widgets {
|
||||
onCommandDeselected?(widget.cmd)
|
||||
|
||||
@@ -368,6 +368,21 @@ struct VirtualKeyboardView: View {
|
||||
let keyID = regularHighlightID(for: key)
|
||||
|
||||
if highlightedKeyIDs.contains(keyID) {
|
||||
if mode != .shortcutPicker {
|
||||
let cmd = key.cmdString(for: keyboardType) ?? ""
|
||||
guard !cmd.isEmpty else { return }
|
||||
if canSelectCommand?(cmd) == false {
|
||||
return
|
||||
}
|
||||
VirtualKeyboardView.tappedKeyLabels = [key.label]
|
||||
VirtualKeyboardView.selectedCmd = cmd
|
||||
VirtualKeyboardView.lastSelectionDisplayText = poolDisplayText(for: key)
|
||||
VirtualKeyboardView.lastSelectionUsesMacLayout = keyboardType == .mac
|
||||
VirtualKeyboardView.lastSelectionFromMouseWidgets = isMouseWidgetKey(key)
|
||||
VirtualKeyboardView.lastSelectionUsesFnCommandDisplay = usesFnCommandDisplay(for: key)
|
||||
onCommandSelected?(cmd)
|
||||
return
|
||||
}
|
||||
highlightedKeyIDs.remove(keyID)
|
||||
if let cmd = key.cmdString(for: keyboardType), !cmd.isEmpty {
|
||||
onCommandDeselected?(cmd)
|
||||
@@ -406,6 +421,20 @@ struct VirtualKeyboardView: View {
|
||||
}
|
||||
|
||||
if directionSingleKeyLabels.contains(key.label) {
|
||||
if mode != .shortcutPicker {
|
||||
let command = key.cmdString(for: keyboardType) ?? key.label
|
||||
if canSelectCommand?(command) == false {
|
||||
return
|
||||
}
|
||||
VirtualKeyboardView.tappedKeyLabels = [key.label]
|
||||
VirtualKeyboardView.selectedCmd = command
|
||||
VirtualKeyboardView.lastSelectionDisplayText = poolDisplayText(for: key)
|
||||
VirtualKeyboardView.lastSelectionUsesMacLayout = keyboardType == .mac
|
||||
VirtualKeyboardView.lastSelectionFromMouseWidgets = false
|
||||
VirtualKeyboardView.lastSelectionUsesFnCommandDisplay = false
|
||||
onCommandSelected?(command)
|
||||
return
|
||||
}
|
||||
directionSingleKeyLabels.remove(key.label)
|
||||
if let cmd = key.cmdString(for: keyboardType), !cmd.isEmpty {
|
||||
onCommandDeselected?(cmd)
|
||||
|
||||
+1350
-179
File diff suppressed because it is too large.
Load diff
@@ -74,8 +74,12 @@ public final class WidgetPickerViewController: UIViewController {
|
||||
view.addSubview(hostingViewController.view)
|
||||
hostingViewController.didMove(toParent: self)
|
||||
|
||||
let hostingTopAnchor = UIDevice.current.userInterfaceIdiom == .phone
|
||||
? view.safeAreaLayoutGuide.topAnchor
|
||||
: view.topAnchor
|
||||
|
||||
NSLayoutConstraint.activate([
|
||||
hostingViewController.view.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor),
|
||||
hostingViewController.view.topAnchor.constraint(equalTo: hostingTopAnchor),
|
||||
hostingViewController.view.bottomAnchor.constraint(equalTo: view.bottomAnchor),
|
||||
hostingViewController.view.leadingAnchor.constraint(equalTo: view.leadingAnchor),
|
||||
hostingViewController.view.trailingAnchor.constraint(equalTo: view.trailingAnchor),
|
||||
@@ -89,11 +93,31 @@ public final class WidgetPickerViewController: UIViewController {
|
||||
navigationController?.setNavigationBarHidden(true, animated: false)
|
||||
}
|
||||
|
||||
public override func viewWillDisappear(_ animated: Bool) {
|
||||
super.viewWillDisappear(animated)
|
||||
presentationState.hasHostAppeared = false
|
||||
}
|
||||
|
||||
public override func viewDidAppear(_ animated: Bool) {
|
||||
super.viewDidAppear(animated)
|
||||
presentationState.hasHostAppeared = true
|
||||
}
|
||||
|
||||
public override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
|
||||
super.viewWillTransition(to: size, with: coordinator)
|
||||
|
||||
presentationState.hasHostAppeared = false
|
||||
|
||||
coordinator.animate(alongsideTransition: nil) { [weak self] context in
|
||||
guard let self else { return }
|
||||
guard !context.isCancelled else {
|
||||
self.presentationState.hasHostAppeared = true
|
||||
return
|
||||
}
|
||||
self.presentationState.hasHostAppeared = true
|
||||
}
|
||||
}
|
||||
|
||||
private func resolvedTabs() -> [WidgetPickerTab] {
|
||||
let tabs = tabIdentifiers.compactMap(WidgetPickerTab.init(identifier:))
|
||||
return tabs.isEmpty ? WidgetPickerTab.allCases : tabs
|
||||
@@ -104,6 +128,11 @@ public final class WidgetPickerViewController: UIViewController {
|
||||
return WidgetPickerTab(identifier: initialTabIdentifier)
|
||||
}
|
||||
|
||||
public func presentOverFullScreen(from presenter: UIViewController, animated: Bool = true) {
|
||||
modalPresentationStyle = .overFullScreen
|
||||
presenter.present(self, animated: animated)
|
||||
}
|
||||
|
||||
public func presentAsOverlay(in parentViewController: UIViewController, animated: Bool = true) {
|
||||
guard parent == nil else { return }
|
||||
guard let originalAppWindow = parentViewController.view.window,
|
||||
|
||||
Reference in new issue
Block a user