Merge pedal-footer-symmetry: Level | bypass | Mix footer
This commit is contained in:
@@ -278,13 +278,14 @@ public struct PedalView: View {
|
|||||||
.clipShape(RoundedRectangle(cornerRadius: PedalView.namePlateCornerRadius))
|
.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 trailing `Mix` and `Level` knobs (the last two entries of `pedal.knobs`) are
|
||||||
/// the bottom control row next to the bypass switch, leaving more room for the effect
|
/// dropped here and rendered in the bottom control row flanking the bypass switch —
|
||||||
/// controls at the top.
|
/// `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 {
|
private var knobGrid: some View {
|
||||||
let knobs: [PedalKnob] = Array(pedal.knobs.dropLast())
|
let knobs: [PedalKnob] = Array(pedal.knobs.dropLast(2))
|
||||||
let rows: [[PedalKnob]] = stride(
|
let rows: [[PedalKnob]] = stride(
|
||||||
from: 0,
|
from: 0,
|
||||||
to: knobs.count,
|
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
|
/// Bottom control row: the `Level` knob, the bypass switch, and the `Mix` knob,
|
||||||
/// with equal padding below.
|
/// side-by-side and centred — a symmetric knob-switch-knob footer shared by all pedals.
|
||||||
private var bottomControls: some View {
|
private var bottomControls: some View {
|
||||||
HStack(alignment: .center, spacing: PedalView.bottomControlsSpacing) {
|
HStack(alignment: .center, spacing: PedalView.bottomControlsSpacing) {
|
||||||
levelControl
|
levelControl
|
||||||
bypassControl
|
bypassControl
|
||||||
|
mixControl
|
||||||
}
|
}
|
||||||
.frame(maxWidth: .infinity)
|
.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
|
@ViewBuilder
|
||||||
private var levelControl: some View {
|
private var levelControl: some View {
|
||||||
if let level: PedalKnob = pedal.knobs.last {
|
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.
|
/// LED + footswitch bypass control, paired beside the Level knob.
|
||||||
private var bypassControl: some View {
|
private var bypassControl: some View {
|
||||||
// Reading `pedal.$bypass.value` here registers this view for automatic
|
// Reading `pedal.$bypass.value` here registers this view for automatic
|
||||||
|
|||||||
Reference in New Issue
Block a user