refactor(ui): make widthUnits mean "base width in columns" + tidy overrides

Follow-up cleanup now that card width is content-derived. Redefine widthUnits
as the card's base width in knob columns (1 = 3-wide, 2 = 4-wide) — both the
knob-grid column count and the card's minimum width — with selector/switch rows
able to push wider. Values above 2 no longer do anything.

- Delete the now-misleading widthUnits 3/4 overrides on 11 amps; they inherit
  AmpVoicePedal's 2 (all full-surface amps → the same tight 4-wide card).
- Remove Mutant's redundant override (2 knobs + 2 switches → 3-wide either way).
- Cabinet: keep widthUnits 2 so it's 4-wide like the amps — its Cab/Mic/Mic B
  selector captions (voice names) need the room to stay readable (per request).
- Looper keeps widthUnits 3 (the one pedal still using the flat multiple for its
  bespoke timeline/knobs/transport layout).
- Refresh the widthUnits docs (base + AmpVoicePedal + Cabinet); update the amp
  tests' widthUnits assertions (3/4 → 2; Looper stays 3).

675 tests pass; no visual change to the amps, Cabinet now matches their width.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-08-05 09:05:40 -07:00
parent a1ce308082
commit 292261a088
26 changed files with 29 additions and 62 deletions
+8 -9
View File
@@ -964,11 +964,12 @@ public struct PedalView: View {
/// Enclosure width, sized to the pedal's **content** rather than a flat `widthUnits × base`
/// multiple (which left control-sparse multi-unit cards — amps, the Cabinet — mostly empty).
///
/// The card fits its widest row: the knob grid (whose column count is capped by `widthUnits` —
/// a dense pedal packs `wideKnobColumnCount` across instead of `knobColumnCount`), the inline
/// selector row, or the switch row — never narrower than the three-slot `Level · Bypass · Mix`
/// footer. It is widened further to fit a vertical-fader bank (e.g. a multi-band graphic EQ) so
/// its faders are never clipped.
/// The card is `columns` wide, where `columns` is the pedal's base knob-grid width from
/// `widthUnits` (`1` → `knobColumnCount`, `≥ 2` → `wideKnobColumnCount`) — so a `widthUnits: 2`
/// pedal is always a four-wide card even if it carries fewer knobs (this is how the Cabinet
/// matches the amps so its selector captions stay readable). A pedal whose selector or switch row
/// is wider than that pushes wider still. It is widened further to fit a vertical-fader bank
/// (e.g. a multi-band graphic EQ) so its faders are never clipped.
///
/// The looper is the exception: its bespoke three-column layout (timeline · knobs · transport)
/// genuinely needs the full multi-unit width, so it keeps the flat multiple.
@@ -976,10 +977,8 @@ public struct PedalView: View {
if pedal is LooperPedal {
return PedalView.enclosureWidth * CGFloat(max(1, pedal.widthUnits))
}
let columnCap: Int = pedal.widthUnits >= 2 ? PedalView.wideKnobColumnCount : PedalView.knobColumnCount
let knobColumns: Int = min(pedal.effectKnobs.count, columnCap)
let footerColumns: Int = 3 // Level · Bypass · Mix (or Level · Bypass · footer selector)
let columns: Int = max(knobColumns, inlineSelectors.count, pedal.effectSwitches.count, footerColumns)
let gridColumns: Int = pedal.widthUnits >= 2 ? PedalView.wideKnobColumnCount : PedalView.knobColumnCount
let columns: Int = max(gridColumns, inlineSelectors.count, pedal.effectSwitches.count)
let contentWidth: CGFloat = 2 * PedalView.enclosurePadding
+ CGFloat(columns) * PedalView.enclosureColumnWidth
+ CGFloat(max(0, columns - 1)) * PedalView.knobSpacing