From da2c3328ee3cef56c13fe2ce25a78b602b9713da Mon Sep 17 00:00:00 2001 From: Joshua Parmenter Date: Tue, 4 Aug 2026 10:01:39 -0700 Subject: [PATCH] ui(cabinet): own category after amps + double-width card + stable selector id MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add a dedicated PedalCategory.cabinet (tweed tan), placed right after Amp Model, and remap the Cabinet pedal to it (was buried in EQ & Filter). Move "Cabinet" in the palette preferredOrder to just after the amps. - CabinetPedal is now double-width (widthUnits 2): three selectors (Cab / Mic / Mic B) crowded at single width, clipping the leading Cab caption and overlapping dials (a drag near the Mic/Mic B boundary could land on the neighbor's gesture — the "moving Mic moved Mic B" report). - Harden the selector-row ForEach: key by the (unique-per-pedal) selector label instead of the array offset, so each selector keeps a stable SwiftUI identity across board rebuilds and can't inherit a sibling's drag state. 669 tests pass. Co-Authored-By: Claude Opus 4.8 --- Sources/LyrebirdShoeGaze/Pedals/CabinetPedal.swift | 4 ++++ Sources/LyrebirdShoeGazeUI/PedalCategory.swift | 4 +++- Sources/LyrebirdShoeGazeUI/PedalPaletteView.swift | 4 ++-- Sources/LyrebirdShoeGazeUI/PedalView.swift | 9 ++++++--- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Sources/LyrebirdShoeGaze/Pedals/CabinetPedal.swift b/Sources/LyrebirdShoeGaze/Pedals/CabinetPedal.swift index bd6382b..94d831f 100644 --- a/Sources/LyrebirdShoeGaze/Pedals/CabinetPedal.swift +++ b/Sources/LyrebirdShoeGaze/Pedals/CabinetPedal.swift @@ -51,6 +51,10 @@ public final class CabinetPedal: Pedal { "Speaker-cabinet impulse-response convolution with selectable built-in voicings." } + /// Double-width card — three selectors (Cab / Mic / Mic B) need the room; at single width the + /// dials crowd and the leading selector's caption clips. + public override var widthUnits: Int { 2 } + // MARK: - Parameters /// Selected cabinet voicing as an index into ``CabinetVoice/allCases``. Snaps to integer diff --git a/Sources/LyrebirdShoeGazeUI/PedalCategory.swift b/Sources/LyrebirdShoeGazeUI/PedalCategory.swift index f3a332d..749faa0 100644 --- a/Sources/LyrebirdShoeGazeUI/PedalCategory.swift +++ b/Sources/LyrebirdShoeGazeUI/PedalCategory.swift @@ -11,6 +11,7 @@ import SwiftUI /// to its category lives here, keyed by name like ``PedalPaletteView``'s preferred order. public enum PedalCategory: String, CaseIterable, Identifiable, Sendable { case amp = "Amp Model" + case cabinet = "Cabinet" case gain = "Gain" case dynamics = "Dynamics" case filter = "EQ & Filter" @@ -26,6 +27,7 @@ public enum PedalCategory: String, CaseIterable, Identifiable, Sendable { var color: Color { switch self { case .amp: return Color(red: 0.70, green: 0.45, blue: 0.18) // warm valve-glow copper + case .cabinet: return Color(red: 0.50, green: 0.36, blue: 0.18) // tweed / cabinet tan case .gain: return Color(red: 0.82, green: 0.38, blue: 0.12) case .dynamics: return Color(red: 0.20, green: 0.50, blue: 0.32) case .filter: return Color(red: 0.14, green: 0.46, blue: 0.55) @@ -48,7 +50,7 @@ public enum PedalCategory: String, CaseIterable, Identifiable, Sendable { "Overdrive": .gain, "Distortion": .gain, "Fuzz": .gain, "Volume": .gain, "Compressor": .dynamics, "Sustainer": .dynamics, "Limiter": .dynamics, "Noise Gate": .dynamics, "Graphic EQ": .filter, "Auto-Wah": .filter, "Wah": .filter, "Mutant": .filter, - "Cabinet": .filter, + "Cabinet": .cabinet, "Tremolo": .modulation, "Phaser": .modulation, "Modulation": .modulation, "Chorus": .modulation, "Flanger": .modulation, "Vibrato": .modulation, "Rotary": .modulation, "Ring Modulator": .modulation, "Bass Octaver": .pitch, "Octave Splitter": .pitch, "Harmonizer": .pitch, diff --git a/Sources/LyrebirdShoeGazeUI/PedalPaletteView.swift b/Sources/LyrebirdShoeGazeUI/PedalPaletteView.swift index 6d62173..9a71d8b 100644 --- a/Sources/LyrebirdShoeGazeUI/PedalPaletteView.swift +++ b/Sources/LyrebirdShoeGazeUI/PedalPaletteView.swift @@ -54,10 +54,10 @@ public struct PedalPaletteView: View { /// Preferred display order for the built-in pedals. Any registered pedal not listed here is /// appended afterwards (sorted) so the palette never silently drops a newly added pedal. private static let preferredOrder: [String] = [ - "California", "British", "British Plexi", "British JTM", "British Bluesbreaker", "British Master", "British Dual", "Boutique Lead", "Boutique OD", "Cali Hi-Gain", "Command", "Citrus", "Sixties Combo", "Magna Vibrato", "Anaheim", "Modern High-Gain", "Chime", "Chime 15", "Chime Normal", "Chime Baby", "Fullerton Reverb", "Fullerton Deluxe", "Fullerton Ivy League", "Fullerton Drive", "Jazz Clean", "Chime Top Boost", "Overdrive", "Distortion", "Compressor", "Sustainer", "Limiter", "Noise Gate", "Fuzz", + "California", "British", "British Plexi", "British JTM", "British Bluesbreaker", "British Master", "British Dual", "Boutique Lead", "Boutique OD", "Cali Hi-Gain", "Command", "Citrus", "Sixties Combo", "Magna Vibrato", "Anaheim", "Modern High-Gain", "Chime", "Chime 15", "Chime Normal", "Chime Baby", "Fullerton Reverb", "Fullerton Deluxe", "Fullerton Ivy League", "Fullerton Drive", "Jazz Clean", "Chime Top Boost", "Cabinet", "Overdrive", "Distortion", "Compressor", "Sustainer", "Limiter", "Noise Gate", "Fuzz", "Volume", "Graphic EQ", "Tremolo", "Phaser", "Modulation", "Chorus", "Flanger", "Vibrato", "Rotary", - "Auto-Wah", "Wah", "Mutant", "Cabinet", "Ring Modulator", "Diffuser", "Bitcrusher", "Granulator", + "Auto-Wah", "Wah", "Mutant", "Ring Modulator", "Diffuser", "Bitcrusher", "Granulator", "Auto Granulator", "Bass Octaver", "Octave Splitter", "Harmonizer", "Delay", "Feedback Delay", "Multi-Tap Delay", "Ping-Pong", "Reverse Delay", "Reverb", "Shimmer Reverb", "Plate Reverb", "Room Reverb", "Spring Reverb", diff --git a/Sources/LyrebirdShoeGazeUI/PedalView.swift b/Sources/LyrebirdShoeGazeUI/PedalView.swift index 7d3f271..c783c50 100644 --- a/Sources/LyrebirdShoeGazeUI/PedalView.swift +++ b/Sources/LyrebirdShoeGazeUI/PedalView.swift @@ -874,10 +874,13 @@ public struct PedalView: View { if !selectors.isEmpty { HStack(alignment: .top, spacing: PedalView.knobRowItemSpacing) { Spacer(minLength: 0) - ForEach(Array(selectors.enumerated()), id: \.offset) { pair in + // Keyed by the (unique-per-pedal) selector label, not the array offset, so each + // selector keeps a stable SwiftUI identity across board rebuilds — a rebuildsOnChange + // selector must not inherit a sibling's drag @State. + ForEach(selectors, id: \.label) { selector in PedalSelectorKnobView( - pair.element, - onCommit: pair.element.rebuildsOnChange + selector, + onCommit: selector.rebuildsOnChange ? { [pedal, pedalRebuildAction] in pedalRebuildAction(pedal) } : nil )