Merge pedal-footer-symmetry: Level | bypass | Mix footer

This commit is contained in:
2026-06-21 15:53:57 -07:00
+20 -8
View File
@@ -278,13 +278,14 @@ public struct PedalView: View {
.clipShape(RoundedRectangle(cornerRadius: PedalView.namePlateCornerRadius))
}
/// Grid of the effect + `Mix` knobs, in rows of up to `knobColumnCount`.
/// Grid of the effect knobs, in rows of up to `knobColumnCount`.
///
/// The `Level` knob (the last entry of `pedal.knobs`) is dropped here and rendered in
/// the bottom control row next to the bypass switch, leaving more room for the effect
/// controls at the top.
/// The trailing `Mix` and `Level` knobs (the last two entries of `pedal.knobs`) are
/// dropped here and rendered in the bottom control row flanking the bypass switch —
/// `Level` on the left, `Mix` on the right — leaving more room for the effect controls
/// at the top and giving every pedal a symmetric footer.
private var knobGrid: some View {
let knobs: [PedalKnob] = Array(pedal.knobs.dropLast())
let knobs: [PedalKnob] = Array(pedal.knobs.dropLast(2))
let rows: [[PedalKnob]] = stride(
from: 0,
to: knobs.count,
@@ -327,17 +328,18 @@ public struct PedalView: View {
}
}
/// Bottom control row: the `Level` knob and the bypass switch side-by-side, centred
/// with equal padding below.
/// Bottom control row: the `Level` knob, the bypass switch, and the `Mix` knob,
/// side-by-side and centred — a symmetric knob-switch-knob footer shared by all pedals.
private var bottomControls: some View {
HStack(alignment: .center, spacing: PedalView.bottomControlsSpacing) {
levelControl
bypassControl
mixControl
}
.frame(maxWidth: .infinity)
}
/// The `Level` knob — the last entry of `pedal.knobs`.
/// The `Level` knob — the last entry of `pedal.knobs` — placed left of the bypass switch.
@ViewBuilder
private var levelControl: some View {
if let level: PedalKnob = pedal.knobs.last {
@@ -346,6 +348,16 @@ public struct PedalView: View {
}
}
/// The `Mix` knob — the second-to-last entry of `pedal.knobs` — placed right of the
/// bypass switch to mirror `Level`.
@ViewBuilder
private var mixControl: some View {
if let mix: PedalKnob = pedal.knobs.dropLast().last {
ParameterKnob(mix.label, node: mix.node, range: mix.range)
.foregroundStyle(Color.white)
}
}
/// LED + footswitch bypass control, paired beside the Level knob.
private var bypassControl: some View {
// Reading `pedal.$bypass.value` here registers this view for automatic