Centre pedal knob rows

Short knob rows (one or two knobs) now sit centred in the enclosure instead of
left-aligned, via symmetric spacers around each row. Shared PedalView, so it
applies on macOS and iOS.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-23 21:26:54 -07:00
parent 6ad813601f
commit f19dc2c1b3
+5 -6
View File
@@ -313,18 +313,17 @@ public struct PedalView: View {
return VStack(spacing: PedalView.knobSpacing) {
ForEach(Array(rows.enumerated()), id: \.offset) { rowPair in
let row: [PedalKnob] = rowPair.element
// Centre each row: a short row (one or two knobs) sits centred in the
// enclosure rather than left-aligned. Symmetric spacers also centre a full
// three-knob row, so every row stays horizontally centred.
HStack(spacing: PedalView.knobSpacing) {
Spacer(minLength: 0)
ForEach(Array(row.enumerated()), id: \.offset) { knobPair in
let knob: PedalKnob = knobPair.element
ParameterKnob(knob.label, node: knob.node, range: knob.range)
.foregroundStyle(Color.white)
}
// Pad short rows so knobs stay aligned in their columns.
if row.count < PedalView.knobColumnCount {
ForEach(0 ..< (PedalView.knobColumnCount - row.count), id: \.self) { _ in
Spacer()
}
}
Spacer(minLength: 0)
}
}
}