iOS compact layout: canvas-first with composition panels in sheets
On narrow widths (iPhone, iPad portrait / split view) the docked desktop layout overflowed and left the board canvas cramped. Add a size-class-gated compact layout; regular widths (macOS, wide iPad) are unchanged. Compact: - Root drops the always-docked rig sidebar; it opens from a "Rigs" sheet button. - Header keeps performance controls on screen (title, Start/Stop, Record badge, Bypass, Mute rig) with a scrollable row of panel toggles. - Composition panels move to bottom sheets: Pedals (palette + routing), Settings (sample rate / channel counts / input source), Rigs (library). - Board mixer, scope, CPU meters, and Tempo/Tuner stay docked above the full-bleed board canvas. EngineConfigView gains a transportOnly mode (Start/Stop button only) so the transport stays in the compact header while the config controls live in the Settings sheet. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -42,6 +42,10 @@ public struct EngineConfigView: View {
|
||||
private let hardwareSampleRate: () -> Double?
|
||||
private let applyConfig: ((Double, Int, Int) throws -> Void)?
|
||||
private let onConfigApplied: () -> Void
|
||||
/// When `true`, renders only the Start/Stop transport button (the sample-rate / channel-count
|
||||
/// controls are hidden). Used by the compact (iPhone / narrow iPad) layout, which keeps the
|
||||
/// transport on screen and moves the config controls into a Settings sheet.
|
||||
private let transportOnly: Bool
|
||||
|
||||
@State private var pendingSampleRate: Double
|
||||
@State private var pendingInputs: Int
|
||||
@@ -63,12 +67,14 @@ public struct EngineConfigView: View {
|
||||
shoeGaze: ShoeGaze,
|
||||
hardwareSampleRate: @escaping () -> Double? = { nil },
|
||||
applyConfig: ((Double, Int, Int) throws -> Void)? = nil,
|
||||
onConfigApplied: @escaping () -> Void = { }
|
||||
onConfigApplied: @escaping () -> Void = { },
|
||||
transportOnly: Bool = false
|
||||
) {
|
||||
self.shoeGaze = shoeGaze
|
||||
self.hardwareSampleRate = hardwareSampleRate
|
||||
self.applyConfig = applyConfig
|
||||
self.onConfigApplied = onConfigApplied
|
||||
self.transportOnly = transportOnly
|
||||
_pendingSampleRate = State(initialValue: shoeGaze.engine.sampleRate)
|
||||
_pendingInputs = State(initialValue: shoeGaze.engine.numInputChannels)
|
||||
_pendingOutputs = State(initialValue: shoeGaze.engine.numOutputChannels)
|
||||
@@ -78,35 +84,36 @@ public struct EngineConfigView: View {
|
||||
|
||||
public var body: some View {
|
||||
_ = transportTick
|
||||
let isRunning: Bool = shoeGaze.engine.isRunning
|
||||
return HStack(spacing: EngineConfigView.rowSpacing) {
|
||||
label("Rate")
|
||||
Picker("Rate", selection: $pendingSampleRate) {
|
||||
ForEach(EngineConfigView.standardRates, id: \.self) { rate in
|
||||
Text("\(Int(rate)) Hz").tag(rate)
|
||||
return Group {
|
||||
if transportOnly {
|
||||
transportButton
|
||||
} else {
|
||||
HStack(spacing: EngineConfigView.rowSpacing) {
|
||||
label("Rate")
|
||||
Picker("Rate", selection: $pendingSampleRate) {
|
||||
ForEach(EngineConfigView.standardRates, id: \.self) { rate in
|
||||
Text("\(Int(rate)) Hz").tag(rate)
|
||||
}
|
||||
}
|
||||
.labelsHidden()
|
||||
.pickerStyle(.menu)
|
||||
.disabled(shoeGaze.engine.isRunning)
|
||||
|
||||
Stepper(value: $pendingInputs, in: 0...EngineConfigView.maxInputs) {
|
||||
Text("In: \(pendingInputs)").foregroundStyle(Color.white)
|
||||
}
|
||||
.disabled(shoeGaze.engine.isRunning)
|
||||
.fixedSize()
|
||||
|
||||
Stepper(value: $pendingOutputs, in: 1...EngineConfigView.maxOutputs) {
|
||||
Text("Out: \(pendingOutputs)").foregroundStyle(Color.white)
|
||||
}
|
||||
.disabled(shoeGaze.engine.isRunning)
|
||||
.fixedSize()
|
||||
|
||||
transportButton
|
||||
}
|
||||
}
|
||||
.labelsHidden()
|
||||
.pickerStyle(.menu)
|
||||
.disabled(isRunning)
|
||||
|
||||
Stepper(value: $pendingInputs, in: 0...EngineConfigView.maxInputs) {
|
||||
Text("In: \(pendingInputs)").foregroundStyle(Color.white)
|
||||
}
|
||||
.disabled(isRunning)
|
||||
.fixedSize()
|
||||
|
||||
Stepper(value: $pendingOutputs, in: 1...EngineConfigView.maxOutputs) {
|
||||
Text("Out: \(pendingOutputs)").foregroundStyle(Color.white)
|
||||
}
|
||||
.disabled(isRunning)
|
||||
.fixedSize()
|
||||
|
||||
Button(isRunning ? "Stop" : "Start") {
|
||||
if isRunning { stopEngine() } else { startEngine() }
|
||||
}
|
||||
.buttonStyle(.borderedProminent)
|
||||
.tint(isRunning ? .red : .green)
|
||||
}
|
||||
.alert(alertTitle, isPresented: $showAlert) {
|
||||
Button("OK", role: .cancel) { }
|
||||
@@ -131,6 +138,16 @@ public struct EngineConfigView: View {
|
||||
.onChange(of: pendingSampleRate) { applyConfigWhileStopped() }
|
||||
}
|
||||
|
||||
/// The Start / Stop transport button, shared by the full and transport-only layouts.
|
||||
private var transportButton: some View {
|
||||
let isRunning: Bool = shoeGaze.engine.isRunning
|
||||
return Button(isRunning ? "Stop" : "Start") {
|
||||
if isRunning { stopEngine() } else { startEngine() }
|
||||
}
|
||||
.buttonStyle(.borderedProminent)
|
||||
.tint(isRunning ? .red : .green)
|
||||
}
|
||||
|
||||
/// Reconfigures the stopped engine with the pending values and notifies the host so views that
|
||||
/// read non-observable engine state refresh. No-op while the engine is running.
|
||||
private func applyConfigWhileStopped() {
|
||||
|
||||
Reference in New Issue
Block a user