iPad: drop the header scope to a full-width strip below the rows in portrait

On narrower portrait widths (smaller iPads / split view) the inline scope overlaid
and clipped the header. Detect portrait by actual size (iPad is .regular in both
orientations) and, in portrait, move the scope to a full-width strip beneath the
control rows — using the ample portrait vertical space. Landscape keeps it inline
beside the transport. Header control rows + transport factored into shared
subviews.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-04 21:56:07 -07:00
parent bf1e09ede3
commit 12e83bd172
@@ -176,6 +176,12 @@ public struct ShoeGazeBuilderView: View {
/// Type filter for the compact Add-Pedal sheet, hoisted so it sits in the sheet's fixed header.
@State private var pedalFilter: PedalCategory?
/// `true` when the window is taller than it is wide (portrait). iPad is `.regular` in both
/// orientations, so this is derived from the actual size, not the size class. In portrait the
/// header scope moves to a full-width strip below the controls (it would otherwise overlay /
/// clip the header on narrower iPads); landscape keeps it inline beside the transport.
@State private var isPortrait: Bool = false
#if !os(macOS)
/// iOS recording-folder picker presentation flag. (macOS uses the Record menu.)
@State private var showRecordingFolderImporter: Bool = false
@@ -258,6 +264,14 @@ public struct ShoeGazeBuilderView: View {
blue: ShoeGazeBuilderView.backgroundBlue
)
)
// Track portrait vs landscape by actual size (iPad is `.regular` in both orientations).
.background(
GeometryReader { proxy in
Color.clear.task(id: proxy.size) {
isPortrait = proxy.size.height > proxy.size.width
}
}
)
// The builder is always dark-themed; force the dark scheme so system controls (nav title,
// steppers, the Record button) use light text instead of black-on-dark in light mode.
.preferredColorScheme(.dark)
@@ -500,50 +514,72 @@ public struct ShoeGazeBuilderView: View {
/// horizontally scrollable row of panel toggles that open the composition sheets.
private var compactHeader: some View {
_ = transportTick
// Left column stacks the three tight rows; scope + transport form a right column spanning
// them, so the tall scope no longer sets row 1's height (which opened a gap above row 2).
// Row 1: title · [Bypass · Mute · Help · MIDI filling to the scope]
// Row 2: Tempo · Tuner
// Row 3: Rigs · Pedals · Settings
return HStack(alignment: .top, spacing: ShoeGazeBuilderView.rowSpacing) {
VStack(alignment: .leading, spacing: ShoeGazeBuilderView.rowSpacing) {
HStack(spacing: ShoeGazeBuilderView.rowSpacing) {
VStack(alignment: .leading, spacing: 1) {
Text("ShoeGaze").font(.headline).bold()
.foregroundStyle(Color.white)
currentRigLabel
}
if shoeGaze.isRecording { recordingBadge }
compactRigControlsRow
// The three control rows stack tight on the left; the transport sits top-right. The scope
// is inline (right, spanning the rows) in landscape, but on narrower portrait widths it
// would overlay/clip the header — so there it drops to a full-width strip below the rows.
// Row 1: title · [Bypass · Mute · Help · MIDI] Row 2: Tempo · Tuner Row 3: Rigs/Pedals/Settings
return VStack(alignment: .leading, spacing: ShoeGazeBuilderView.rowSpacing) {
HStack(alignment: .top, spacing: ShoeGazeBuilderView.rowSpacing) {
headerControlRows
if !isPortrait {
headerScope
.frame(width: ShoeGazeBuilderView.compactHeaderScopeWidth)
}
HStack(spacing: ShoeGazeBuilderView.rowSpacing) {
TempoView(shoeGaze: shoeGaze)
TunerView(shoeGaze: shoeGaze)
headerTransport
}
if isPortrait {
headerScope
.frame(maxWidth: .infinity)
}
}
}
/// The three stacked control rows shared by both orientations.
private var headerControlRows: some View {
VStack(alignment: .leading, spacing: ShoeGazeBuilderView.rowSpacing) {
HStack(spacing: ShoeGazeBuilderView.rowSpacing) {
VStack(alignment: .leading, spacing: 1) {
Text("ShoeGaze").font(.headline).bold()
.foregroundStyle(Color.white)
currentRigLabel
}
.environment(\.shoeGazeTempoEnabled, shoeGaze.tempoEnabled)
compactPanelRow
if shoeGaze.isRecording { recordingBadge }
compactRigControlsRow
}
// A narrow scope sits left of the transport cluster to use the header's dead space.
ShoeGazeScopeView(shoeGaze: shoeGaze)
.frame(
width: ShoeGazeBuilderView.compactHeaderScopeWidth,
height: ShoeGazeBuilderView.compactHeaderScopeHeight
)
// Transport stays on screen (performance): Start / Stop over Record.
VStack(alignment: .trailing, spacing: ShoeGazeBuilderView.rowSpacing) {
EngineConfigView(
shoeGaze: shoeGaze,
hardwareSampleRate: hardwareSampleRate,
onConfigApplied: { transportTick.toggle() },
transportOnly: true
)
#if !os(macOS)
recordButton
#endif
HStack(spacing: ShoeGazeBuilderView.rowSpacing) {
TempoView(shoeGaze: shoeGaze)
TunerView(shoeGaze: shoeGaze)
}
.environment(\.shoeGazeTempoEnabled, shoeGaze.tempoEnabled)
compactPanelRow
}
.frame(maxWidth: .infinity, alignment: .leading)
}
/// The oscilloscope, sized to the shared header height. Its width is set by the caller
/// (fixed inline in landscape, full-width strip in portrait).
private var headerScope: some View {
ShoeGazeScopeView(shoeGaze: shoeGaze)
.frame(height: ShoeGazeBuilderView.compactHeaderScopeHeight)
}
/// The Start / Stop over Record transport cluster (top-right in both orientations).
private var headerTransport: some View {
VStack(alignment: .trailing, spacing: ShoeGazeBuilderView.rowSpacing) {
EngineConfigView(
shoeGaze: shoeGaze,
hardwareSampleRate: hardwareSampleRate,
onConfigApplied: { transportTick.toggle() },
transportOnly: true
)
#if !os(macOS)
recordButton
#endif
}
}