app icon and splash screen updates
This commit is contained in:
@@ -51,6 +51,10 @@ public struct BoardFlowView: View {
|
||||
private static let splitToggleWidth: CGFloat = 200
|
||||
private static let emptyLaneOpacity: Double = 0.4
|
||||
|
||||
/// Extra height the content may exceed the viewport by before vertical scrolling turns on, so a
|
||||
/// sub-pixel rounding difference doesn't flip the axis set on and off.
|
||||
private static let verticalScrollSlack: CGFloat = 1
|
||||
|
||||
/// Signal-path accent (the pink/magenta connector colour).
|
||||
private static let flowColor: Color = Color(red: 0.92, green: 0.32, blue: 0.70)
|
||||
|
||||
@@ -62,6 +66,10 @@ public struct BoardFlowView: View {
|
||||
/// Identifier of the lane/card currently hovered as a drop target, for highlight.
|
||||
@State private var dropTarget: String?
|
||||
|
||||
/// Measured height of the flow content, used to enable vertical scrolling only when the stacked
|
||||
/// lanes exceed the viewport height (tall parallel splits). Otherwise scrolling stays horizontal.
|
||||
@State private var contentHeight: CGFloat = 0
|
||||
|
||||
public init(shoeGaze: ShoeGaze, boardIndex: Int) {
|
||||
self.shoeGaze = shoeGaze
|
||||
self.boardIndex = boardIndex
|
||||
@@ -81,19 +89,55 @@ public struct BoardFlowView: View {
|
||||
|
||||
private func flow(board: PedalBoard) -> some View {
|
||||
let stages: [StageModel] = stageModels(board: board)
|
||||
return ScrollView([.horizontal, .vertical], showsIndicators: true) {
|
||||
HStack(alignment: .center, spacing: BoardFlowView.stageSpacing) {
|
||||
endpoint("IN")
|
||||
ForEach(stages) { stage in
|
||||
connector(stereo: stage.stereoIn)
|
||||
stageView(stage)
|
||||
return GeometryReader { proxy in
|
||||
let viewportHeight: CGFloat = proxy.size.height
|
||||
// Lock to horizontal, adding the vertical axis only when the chain is taller than the
|
||||
// viewport (deep parallel splits) so it can be reached instead of clipped.
|
||||
let axes: Axis.Set = contentHeight > viewportHeight + BoardFlowView.verticalScrollSlack
|
||||
? [.horizontal, .vertical]
|
||||
: .horizontal
|
||||
ScrollView(axes, showsIndicators: true) {
|
||||
// The spacers centre the chain vertically when it is shorter than the viewport; when
|
||||
// it overflows, the min-height floor is already exceeded so they collapse to zero and
|
||||
// the chain scrolls. Pedals keep their intrinsic height either way — the window no
|
||||
// longer stretches them.
|
||||
VStack(spacing: 0) {
|
||||
Spacer(minLength: 0)
|
||||
chainRow(board: board, stages: stages)
|
||||
Spacer(minLength: 0)
|
||||
}
|
||||
connector(stereo: board.width == 2)
|
||||
endpoint(board.width == 2 ? "OUT ⇒" : "OUT")
|
||||
.frame(minHeight: viewportHeight)
|
||||
}
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
.onPreferenceChange(BoardFlowContentHeightKey.self) { height in
|
||||
contentHeight = height
|
||||
}
|
||||
.padding(.vertical, BoardFlowView.regionPadding)
|
||||
}
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
}
|
||||
|
||||
/// The left→right chain of endpoints, connectors and stage cards. Reports its own intrinsic
|
||||
/// height through `BoardFlowContentHeightKey` so `flow` can decide whether vertical scrolling is
|
||||
/// needed. Each pedal sizes to its own content, so the row is only as tall as its tallest card —
|
||||
/// a short pedal stays short next to a tall one.
|
||||
private func chainRow(board: PedalBoard, stages: [StageModel]) -> some View {
|
||||
HStack(alignment: .center, spacing: BoardFlowView.stageSpacing) {
|
||||
endpoint("IN")
|
||||
ForEach(stages) { stage in
|
||||
connector(stereo: stage.stereoIn)
|
||||
stageView(stage)
|
||||
}
|
||||
connector(stereo: board.width == 2)
|
||||
endpoint(board.width == 2 ? "OUT ⇒" : "OUT")
|
||||
}
|
||||
.padding(.vertical, BoardFlowView.regionPadding)
|
||||
.background(
|
||||
GeometryReader { contentProxy in
|
||||
Color.clear.preference(
|
||||
key: BoardFlowContentHeightKey.self,
|
||||
value: contentProxy.size.height
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
// MARK: - Stage model
|
||||
@@ -531,3 +575,12 @@ private extension String {
|
||||
return String(dropFirst(prefix.count))
|
||||
}
|
||||
}
|
||||
|
||||
/// Carries the measured height of the flow content up to `BoardFlowView`, which compares it to the
|
||||
/// viewport height to decide whether the vertical scroll axis is needed.
|
||||
private struct BoardFlowContentHeightKey: PreferenceKey {
|
||||
static let defaultValue: CGFloat = 0
|
||||
static func reduce(value: inout CGFloat, nextValue: () -> CGFloat) {
|
||||
value = max(value, nextValue())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -474,7 +474,20 @@ public struct PedalView: View {
|
||||
// the enclosure-width calculation consume the same array.
|
||||
let sliders: [PedalSlider] = pedal.effectSliders
|
||||
|
||||
ZStack(alignment: .topLeading) {
|
||||
// Content is the sizing layer so the enclosure hugs it vertically — a short pedal stays
|
||||
// short. The gradient fill and border/screw strokes are attached as background/overlay so
|
||||
// they conform to the content height instead of a greedy `RoundedRectangle` in a ZStack
|
||||
// dictating (and stretching) the height to fill the row.
|
||||
Group {
|
||||
if let looper: LooperPedal = pedal as? LooperPedal {
|
||||
looperColumnarContent(looper)
|
||||
} else {
|
||||
defaultContent(sliders: sliders)
|
||||
}
|
||||
}
|
||||
.padding(PedalView.enclosurePadding)
|
||||
.frame(width: enclosureWidth(for: sliders))
|
||||
.background(
|
||||
// Enclosure fill with top-to-bottom gradient
|
||||
RoundedRectangle(cornerRadius: PedalView.enclosureCornerRadius)
|
||||
.fill(
|
||||
@@ -484,38 +497,28 @@ public struct PedalView: View {
|
||||
endPoint: .bottom
|
||||
)
|
||||
)
|
||||
|
||||
// Outer border
|
||||
RoundedRectangle(cornerRadius: PedalView.enclosureCornerRadius)
|
||||
.stroke(Color.black.opacity(PedalView.outerBorderOpacity),
|
||||
lineWidth: PedalView.outerBorderLineWidth)
|
||||
|
||||
)
|
||||
.overlay(
|
||||
// Inner highlight rim (subtle bevel)
|
||||
RoundedRectangle(cornerRadius: PedalView.enclosureCornerRadius - PedalView.innerHighlightPadding)
|
||||
.stroke(Color.white.opacity(PedalView.innerHighlightOpacity),
|
||||
lineWidth: PedalView.innerHighlightLineWidth)
|
||||
.padding(PedalView.innerHighlightPadding)
|
||||
|
||||
// Content stack — the looper uses a wide, columnar layout to stay short; every other
|
||||
// pedal uses the default single-column section stack.
|
||||
Group {
|
||||
if let looper: LooperPedal = pedal as? LooperPedal {
|
||||
looperColumnarContent(looper)
|
||||
} else {
|
||||
defaultContent(sliders: sliders)
|
||||
}
|
||||
}
|
||||
.padding(PedalView.enclosurePadding)
|
||||
|
||||
// Corner screws — overlaid at the four corners
|
||||
screwCorners
|
||||
|
||||
// Info button, tucked just under the top-left corner screw.
|
||||
)
|
||||
.overlay(
|
||||
// Outer border
|
||||
RoundedRectangle(cornerRadius: PedalView.enclosureCornerRadius)
|
||||
.stroke(Color.black.opacity(PedalView.outerBorderOpacity),
|
||||
lineWidth: PedalView.outerBorderLineWidth)
|
||||
)
|
||||
// Corner screws — overlaid at the four corners.
|
||||
.overlay { screwCorners }
|
||||
// Info button, tucked just under the top-left corner screw.
|
||||
.overlay(alignment: .topLeading) {
|
||||
infoButton
|
||||
.padding(.leading, PedalView.infoButtonLeading)
|
||||
.padding(.top, PedalView.infoButtonTop)
|
||||
}
|
||||
.frame(width: enclosureWidth(for: sliders))
|
||||
.shadow(
|
||||
color: Color.black.opacity(PedalView.shadowOpacity),
|
||||
radius: PedalView.shadowRadius,
|
||||
@@ -543,7 +546,6 @@ public struct PedalView: View {
|
||||
.id(ObjectIdentifier(pedal))
|
||||
buttonRow
|
||||
sliderBank(sliders)
|
||||
Spacer(minLength: 0)
|
||||
bottomControls
|
||||
PedalMappingStrip(pedal: pedal, map: controlMappingMap)
|
||||
}
|
||||
@@ -579,7 +581,6 @@ public struct PedalView: View {
|
||||
looperTransportGrid(columns: 2)
|
||||
.id(ObjectIdentifier(pedal))
|
||||
}
|
||||
Spacer(minLength: 0)
|
||||
PedalMappingStrip(pedal: pedal, map: controlMappingMap)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user