ui(cabinet): own category after amps + double-width card + stable selector id
- 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 <noreply@anthropic.com>
This commit is contained in:
@@ -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
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user