From 17a0845225c9c9f18a63af4cbdc4e4d481e2bced Mon Sep 17 00:00:00 2001 From: Joshua Parmenter Date: Mon, 3 Aug 2026 09:07:22 -0700 Subject: [PATCH] fix(ui): harden horizontal switch row layout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Switches now lay out side by side (HStack). Polish so it degrades cleanly: - PedalSwitchView caption: lineLimit(1) — no wrap → no height jitter between switches sharing a row. - switchRow: .top alignment so segment bars stay level; doc updated (no longer "one per row"). - MutantPedal: widthUnits 2 so its Sweep (2-way) + Mode (3-way) switches sit side by side without cramping in a single-width card. UI-only; no audio/state changes. Co-Authored-By: Claude Opus 4.8 --- Sources/LyrebirdShoeGaze/Pedals/MutantPedal.swift | 4 ++++ Sources/LyrebirdShoeGazeUI/PedalSwitchView.swift | 1 + Sources/LyrebirdShoeGazeUI/PedalView.swift | 7 ++++--- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Sources/LyrebirdShoeGaze/Pedals/MutantPedal.swift b/Sources/LyrebirdShoeGaze/Pedals/MutantPedal.swift index 21487a7..2a1e8a6 100644 --- a/Sources/LyrebirdShoeGaze/Pedals/MutantPedal.swift +++ b/Sources/LyrebirdShoeGaze/Pedals/MutantPedal.swift @@ -31,6 +31,10 @@ public final class MutantPedal: Pedal { "Envelope-following auto-wah / funk filter that opens with your picking." } + /// Double-width so the two switches — Sweep (2-way) and the 3-way Mode — sit side by side + /// without cramping now that switches lay out horizontally. + public override var widthUnits: Int { 2 } + // MARK: - Parameters /// Filter response selector. `0` = lowpass, `1` = bandpass, `2` = highpass. Driven by a three-state switch. diff --git a/Sources/LyrebirdShoeGazeUI/PedalSwitchView.swift b/Sources/LyrebirdShoeGazeUI/PedalSwitchView.swift index 65c3608..c776b65 100644 --- a/Sources/LyrebirdShoeGazeUI/PedalSwitchView.swift +++ b/Sources/LyrebirdShoeGazeUI/PedalSwitchView.swift @@ -87,6 +87,7 @@ public struct PedalSwitchView: View { Text(inert ? "\(pedalSwitch.label) (tempo off)" : pedalSwitch.label) .font(.system(size: PedalSwitchView.captionFontSize)) .foregroundStyle(Color.white) + .lineLimit(1) } .disabled(inert) .opacity(inert ? PedalSwitchView.tempoDisabledOpacity : 1.0) diff --git a/Sources/LyrebirdShoeGazeUI/PedalView.swift b/Sources/LyrebirdShoeGazeUI/PedalView.swift index b323a6a..8684b1a 100644 --- a/Sources/LyrebirdShoeGazeUI/PedalView.swift +++ b/Sources/LyrebirdShoeGazeUI/PedalView.swift @@ -791,13 +791,14 @@ public struct PedalView: View { } } - /// Row of segmented switches drawn from `pedal.effectSwitches`, one per row, beneath - /// the knob grid. Renders nothing when the pedal publishes no switches. + /// Row of segmented switches drawn from `pedal.effectSwitches`, laid out side by side beneath + /// the knob grid. Renders nothing when the pedal publishes no switches. `.top` alignment keeps + /// the segment bars level even if one switch's caption wraps differently. @ViewBuilder private var switchRow: some View { let switches: [PedalSwitch] = pedal.effectSwitches if !switches.isEmpty { - HStack(spacing: PedalView.knobSpacing) { + HStack(alignment: .top, spacing: PedalView.knobSpacing) { ForEach(Array(switches.enumerated()), id: \.offset) { pair in PedalSwitchView(pair.element) }