Rework builder layout: scope beside stacked mixer + horizontal pedal picker
Reclaim vertical space in ShoeGazeBuilderView. The top section now places the scope + CPU meters on the left (width matched to the mixer's Solo/Blend/All control column) and a right column that stacks the board mixer over a horizontal pedal picker. The board canvas takes the full width below. - PedalPaletteView gains an `axis` parameter: `.vertical` keeps the full-width sidebar column; `.horizontal` lays the catalog out as a row of fixed-width cards for a horizontal scroller. - Remove the old left palette sidebar and the stacked-under-palette scope. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -45,6 +45,8 @@ public struct PedalPaletteView: View {
|
|||||||
private static let rowSubtitleSpacing: CGFloat = 2
|
private static let rowSubtitleSpacing: CGFloat = 2
|
||||||
/// Opacity of the pedal-row description subtitle.
|
/// Opacity of the pedal-row description subtitle.
|
||||||
private static let summaryOpacity: Double = 0.55
|
private static let summaryOpacity: Double = 0.55
|
||||||
|
/// Fixed card width when laid out horizontally (the vertical layout stretches to fill instead).
|
||||||
|
private static let horizontalCardWidth: CGFloat = 150
|
||||||
|
|
||||||
/// Preferred display order for the built-in pedals. Any registered pedal not listed here is
|
/// Preferred display order for the built-in pedals. Any registered pedal not listed here is
|
||||||
/// appended afterwards (sorted) so the palette never silently drops a newly added pedal.
|
/// appended afterwards (sorted) so the palette never silently drops a newly added pedal.
|
||||||
@@ -74,19 +76,25 @@ public struct PedalPaletteView: View {
|
|||||||
|
|
||||||
private let onAdd: (String) -> Void
|
private let onAdd: (String) -> Void
|
||||||
private let onRouting: (RoutingAction) -> Void
|
private let onRouting: (RoutingAction) -> Void
|
||||||
|
private let axis: Axis
|
||||||
|
|
||||||
// MARK: - Init
|
// MARK: - Init
|
||||||
|
|
||||||
/// Creates a pedal palette.
|
/// Creates a pedal palette.
|
||||||
///
|
///
|
||||||
/// - Parameters:
|
/// - Parameters:
|
||||||
|
/// - axis: `.vertical` (default) lays the catalog out as a full-width column for a sidebar;
|
||||||
|
/// `.horizontal` lays it out as a fixed-width-card row for a horizontal scroller. The host
|
||||||
|
/// wraps the view in a `ScrollView` of the matching axis.
|
||||||
/// - onAdd: Invoked with a pedal's `displayName` when its row is tapped (append to main chain).
|
/// - onAdd: Invoked with a pedal's `displayName` when its row is tapped (append to main chain).
|
||||||
/// Rows are also `.draggable` carrying `"add:<displayName>"` for drop-onto-lane targeting.
|
/// Rows are also `.draggable` carrying `"add:<displayName>"` for drop-onto-lane targeting.
|
||||||
/// - onRouting: Invoked when a routing row is tapped. Defaults to a no-op.
|
/// - onRouting: Invoked when a routing row is tapped. Defaults to a no-op.
|
||||||
public init(
|
public init(
|
||||||
|
axis: Axis = .vertical,
|
||||||
onAdd: @escaping (String) -> Void,
|
onAdd: @escaping (String) -> Void,
|
||||||
onRouting: @escaping (RoutingAction) -> Void = { _ in }
|
onRouting: @escaping (RoutingAction) -> Void = { _ in }
|
||||||
) {
|
) {
|
||||||
|
self.axis = axis
|
||||||
self.onAdd = onAdd
|
self.onAdd = onAdd
|
||||||
self.onRouting = onRouting
|
self.onRouting = onRouting
|
||||||
}
|
}
|
||||||
@@ -104,6 +112,14 @@ public struct PedalPaletteView: View {
|
|||||||
// MARK: - Body
|
// MARK: - Body
|
||||||
|
|
||||||
public var body: some View {
|
public var body: some View {
|
||||||
|
switch axis {
|
||||||
|
case .horizontal: horizontalBody
|
||||||
|
default: verticalBody
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Full-width column for a left sidebar.
|
||||||
|
private var verticalBody: some View {
|
||||||
VStack(alignment: .leading, spacing: PedalPaletteView.sectionSpacing) {
|
VStack(alignment: .leading, spacing: PedalPaletteView.sectionSpacing) {
|
||||||
VStack(alignment: .leading, spacing: PedalPaletteView.rowSpacing) {
|
VStack(alignment: .leading, spacing: PedalPaletteView.rowSpacing) {
|
||||||
sectionTitle("PEDALS")
|
sectionTitle("PEDALS")
|
||||||
@@ -121,6 +137,22 @@ public struct PedalPaletteView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Fixed-width-card row for a horizontal scroller: leading PEDALS group, a divider, then the
|
||||||
|
/// ROUTING group.
|
||||||
|
private var horizontalBody: some View {
|
||||||
|
HStack(alignment: .top, spacing: PedalPaletteView.rowSpacing) {
|
||||||
|
sectionTitle("PEDALS")
|
||||||
|
ForEach(orderedPedalNames, id: \.self) { name in
|
||||||
|
pedalRow(name)
|
||||||
|
}
|
||||||
|
Divider().overlay(Color.white.opacity(PedalPaletteView.cardBorderOpacity))
|
||||||
|
sectionTitle("ROUTING")
|
||||||
|
ForEach(PedalPaletteView.routingOptions, id: \.title) { option in
|
||||||
|
routingCard(title: option.title, caption: option.caption, action: option.action)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// MARK: - Subviews
|
// MARK: - Subviews
|
||||||
|
|
||||||
private func sectionTitle(_ text: String) -> some View {
|
private func sectionTitle(_ text: String) -> some View {
|
||||||
@@ -158,7 +190,7 @@ public struct PedalPaletteView: View {
|
|||||||
}
|
}
|
||||||
.padding(.horizontal, PedalPaletteView.cardPaddingH)
|
.padding(.horizontal, PedalPaletteView.cardPaddingH)
|
||||||
.padding(.vertical, PedalPaletteView.cardPaddingV)
|
.padding(.vertical, PedalPaletteView.cardPaddingV)
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
.modifier(CardFrame(axis: axis, width: PedalPaletteView.horizontalCardWidth))
|
||||||
.background(cardBackground(brightness: PedalPaletteView.pedalCardBrightness))
|
.background(cardBackground(brightness: PedalPaletteView.pedalCardBrightness))
|
||||||
}
|
}
|
||||||
.buttonStyle(.plain)
|
.buttonStyle(.plain)
|
||||||
@@ -180,12 +212,27 @@ public struct PedalPaletteView: View {
|
|||||||
}
|
}
|
||||||
.padding(.horizontal, PedalPaletteView.cardPaddingH)
|
.padding(.horizontal, PedalPaletteView.cardPaddingH)
|
||||||
.padding(.vertical, PedalPaletteView.cardPaddingV)
|
.padding(.vertical, PedalPaletteView.cardPaddingV)
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
.modifier(CardFrame(axis: axis, width: PedalPaletteView.horizontalCardWidth))
|
||||||
.background(cardBackground(brightness: PedalPaletteView.routingCardBrightness))
|
.background(cardBackground(brightness: PedalPaletteView.routingCardBrightness))
|
||||||
}
|
}
|
||||||
.buttonStyle(.plain)
|
.buttonStyle(.plain)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Stretches a card to fill width in a vertical column, or pins it to a fixed width in a
|
||||||
|
/// horizontal row.
|
||||||
|
private struct CardFrame: ViewModifier {
|
||||||
|
let axis: Axis
|
||||||
|
let width: CGFloat
|
||||||
|
func body(content: Content) -> some View {
|
||||||
|
switch axis {
|
||||||
|
case .horizontal:
|
||||||
|
content.frame(width: width, alignment: .leading)
|
||||||
|
default:
|
||||||
|
content.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private func cardBackground(brightness: Double) -> some View {
|
private func cardBackground(brightness: Double) -> some View {
|
||||||
RoundedRectangle(cornerRadius: PedalPaletteView.cardCornerRadius)
|
RoundedRectangle(cornerRadius: PedalPaletteView.cardCornerRadius)
|
||||||
.fill(Color(white: brightness))
|
.fill(Color(white: brightness))
|
||||||
|
|||||||
@@ -43,6 +43,9 @@ public struct ShoeGazeBuilderView: View {
|
|||||||
private static let minWidth: CGFloat = 720
|
private static let minWidth: CGFloat = 720
|
||||||
private static let minHeight: CGFloat = 460
|
private static let minHeight: CGFloat = 460
|
||||||
private static let sidebarWidth: CGFloat = 168
|
private static let sidebarWidth: CGFloat = 168
|
||||||
|
/// Width of the scope/CPU block in the bottom strip — matches `BoardBarView`'s Solo/Blend/All
|
||||||
|
/// control column so the scope aligns under it.
|
||||||
|
private static let scopeWidth: CGFloat = 188
|
||||||
private static let columnSpacing: CGFloat = 14
|
private static let columnSpacing: CGFloat = 14
|
||||||
private static let backgroundRed: Double = 0.08
|
private static let backgroundRed: Double = 0.08
|
||||||
private static let backgroundGreen: Double = 0.07
|
private static let backgroundGreen: Double = 0.07
|
||||||
@@ -268,7 +271,8 @@ public struct ShoeGazeBuilderView: View {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The main builder column: transport, IO, boards, palette, board area, scope, and status.
|
/// The main builder column: transport, IO, the scope-plus-mixer/picker top section, then the
|
||||||
|
/// board canvas.
|
||||||
private var builderColumn: some View {
|
private var builderColumn: some View {
|
||||||
VStack(alignment: .leading, spacing: ShoeGazeBuilderView.sectionSpacing) {
|
VStack(alignment: .leading, spacing: ShoeGazeBuilderView.sectionSpacing) {
|
||||||
transportRow
|
transportRow
|
||||||
@@ -277,6 +281,27 @@ public struct ShoeGazeBuilderView: View {
|
|||||||
recordingRow
|
recordingRow
|
||||||
#endif
|
#endif
|
||||||
Divider().overlay(Color.white.opacity(ShoeGazeBuilderView.dividerOpacity))
|
Divider().overlay(Color.white.opacity(ShoeGazeBuilderView.dividerOpacity))
|
||||||
|
topSection
|
||||||
|
Divider().overlay(Color.white.opacity(ShoeGazeBuilderView.dividerOpacity))
|
||||||
|
boardArea
|
||||||
|
}
|
||||||
|
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Top section: the scope + CPU meters on the left (sized to align with the mixer's
|
||||||
|
/// Solo/Blend/All control column), and a right column stacking the board mixer over the
|
||||||
|
/// horizontal pedal picker.
|
||||||
|
private var topSection: some View {
|
||||||
|
HStack(alignment: .top, spacing: ShoeGazeBuilderView.columnSpacing) {
|
||||||
|
VStack(alignment: .leading, spacing: ShoeGazeBuilderView.rowSpacing) {
|
||||||
|
ShoeGazeScopeView(shoeGaze: shoeGaze)
|
||||||
|
LyrebirdStatusView(engine: shoeGaze.engine)
|
||||||
|
}
|
||||||
|
.frame(width: ShoeGazeBuilderView.scopeWidth, alignment: .leading)
|
||||||
|
|
||||||
|
Divider().overlay(Color.white.opacity(ShoeGazeBuilderView.dividerOpacity))
|
||||||
|
|
||||||
|
VStack(alignment: .leading, spacing: ShoeGazeBuilderView.sectionSpacing) {
|
||||||
BoardBarView(
|
BoardBarView(
|
||||||
shoeGaze: shoeGaze,
|
shoeGaze: shoeGaze,
|
||||||
editingBoardIndex: $selectedBoardIndex,
|
editingBoardIndex: $selectedBoardIndex,
|
||||||
@@ -284,19 +309,24 @@ public struct ShoeGazeBuilderView: View {
|
|||||||
onAddBoard: { addBoard() }
|
onAddBoard: { addBoard() }
|
||||||
)
|
)
|
||||||
Divider().overlay(Color.white.opacity(ShoeGazeBuilderView.dividerOpacity))
|
Divider().overlay(Color.white.opacity(ShoeGazeBuilderView.dividerOpacity))
|
||||||
HStack(alignment: .top, spacing: ShoeGazeBuilderView.columnSpacing) {
|
pedalPickerRow
|
||||||
paletteSidebar
|
|
||||||
Divider().overlay(Color.white.opacity(ShoeGazeBuilderView.dividerOpacity))
|
|
||||||
boardArea
|
|
||||||
}
|
}
|
||||||
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
// Scope + CPU meters sit under the pedal palette, matching its width.
|
|
||||||
ShoeGazeScopeView(shoeGaze: shoeGaze)
|
|
||||||
.frame(width: ShoeGazeBuilderView.sidebarWidth, alignment: .leading)
|
|
||||||
LyrebirdStatusView(engine: shoeGaze.engine)
|
|
||||||
.frame(width: ShoeGazeBuilderView.sidebarWidth, alignment: .leading)
|
|
||||||
}
|
}
|
||||||
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
|
.fixedSize(horizontal: false, vertical: true)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A compact horizontal pedal-picker strip (sits below the board mixer in the top section).
|
||||||
|
private var pedalPickerRow: some View {
|
||||||
|
ScrollView(.horizontal, showsIndicators: true) {
|
||||||
|
PedalPaletteView(
|
||||||
|
axis: .horizontal,
|
||||||
|
onAdd: { type in addPedal(type: type) },
|
||||||
|
onRouting: { action in performRouting(action) }
|
||||||
|
)
|
||||||
|
.padding(.bottom, 2)
|
||||||
|
}
|
||||||
|
.fixedSize(horizontal: false, vertical: true)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Presentation anchors
|
// MARK: - Presentation anchors
|
||||||
@@ -414,19 +444,6 @@ public struct ShoeGazeBuilderView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Palette sidebar
|
|
||||||
|
|
||||||
private var paletteSidebar: some View {
|
|
||||||
ScrollView(.vertical, showsIndicators: true) {
|
|
||||||
PedalPaletteView(
|
|
||||||
onAdd: { type in addPedal(type: type) },
|
|
||||||
onRouting: { action in performRouting(action) }
|
|
||||||
)
|
|
||||||
.padding(.trailing, 2)
|
|
||||||
}
|
|
||||||
.frame(width: ShoeGazeBuilderView.sidebarWidth)
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: - Board area
|
// MARK: - Board area
|
||||||
|
|
||||||
private var boardArea: some View {
|
private var boardArea: some View {
|
||||||
|
|||||||
Reference in New Issue
Block a user