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())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user