diff --git a/Demo/ShoeGazeBuilder.xcodeproj/project.pbxproj b/Demo/ShoeGazeBuilder.xcodeproj/project.pbxproj index fea3c05..8ef7273 100644 --- a/Demo/ShoeGazeBuilder.xcodeproj/project.pbxproj +++ b/Demo/ShoeGazeBuilder.xcodeproj/project.pbxproj @@ -163,7 +163,7 @@ "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 11; + CURRENT_PROJECT_VERSION = 12; DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_HARDENED_RUNTIME = YES; @@ -175,7 +175,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 15.0; - MARKETING_VERSION = 2.1.3; + MARKETING_VERSION = 2.1.4; PRODUCT_BUNDLE_IDENTIFIER = net.realizedsound.ShoeGazeBuilder; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; @@ -193,7 +193,7 @@ "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 11; + CURRENT_PROJECT_VERSION = 12; DEAD_CODE_STRIPPING = YES; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = ShoeGazeBuilder/Info.plist; @@ -204,7 +204,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 15.0; - MARKETING_VERSION = 2.1.3; + MARKETING_VERSION = 2.1.4; PRODUCT_BUNDLE_IDENTIFIER = net.realizedsound.ShoeGazeBuilder; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; diff --git a/Demo/ShoeGazeBuilder/Assets.xcassets/AppIcon.appiconset/icon_128x128.png b/Demo/ShoeGazeBuilder/Assets.xcassets/AppIcon.appiconset/icon_128x128.png index 11eb204..208bda5 100644 Binary files a/Demo/ShoeGazeBuilder/Assets.xcassets/AppIcon.appiconset/icon_128x128.png and b/Demo/ShoeGazeBuilder/Assets.xcassets/AppIcon.appiconset/icon_128x128.png differ diff --git a/Demo/ShoeGazeBuilder/Assets.xcassets/AppIcon.appiconset/icon_128x128@2x.png b/Demo/ShoeGazeBuilder/Assets.xcassets/AppIcon.appiconset/icon_128x128@2x.png index 9fb9569..3eb851e 100644 Binary files a/Demo/ShoeGazeBuilder/Assets.xcassets/AppIcon.appiconset/icon_128x128@2x.png and b/Demo/ShoeGazeBuilder/Assets.xcassets/AppIcon.appiconset/icon_128x128@2x.png differ diff --git a/Demo/ShoeGazeBuilder/Assets.xcassets/AppIcon.appiconset/icon_16x16.png b/Demo/ShoeGazeBuilder/Assets.xcassets/AppIcon.appiconset/icon_16x16.png index 9a6d8ba..a25ce0f 100644 Binary files a/Demo/ShoeGazeBuilder/Assets.xcassets/AppIcon.appiconset/icon_16x16.png and b/Demo/ShoeGazeBuilder/Assets.xcassets/AppIcon.appiconset/icon_16x16.png differ diff --git a/Demo/ShoeGazeBuilder/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x.png b/Demo/ShoeGazeBuilder/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x.png index 746cd1c..2dd8bc5 100644 Binary files a/Demo/ShoeGazeBuilder/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x.png and b/Demo/ShoeGazeBuilder/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x.png differ diff --git a/Demo/ShoeGazeBuilder/Assets.xcassets/AppIcon.appiconset/icon_256x256.png b/Demo/ShoeGazeBuilder/Assets.xcassets/AppIcon.appiconset/icon_256x256.png index 9fb9569..3eb851e 100644 Binary files a/Demo/ShoeGazeBuilder/Assets.xcassets/AppIcon.appiconset/icon_256x256.png and b/Demo/ShoeGazeBuilder/Assets.xcassets/AppIcon.appiconset/icon_256x256.png differ diff --git a/Demo/ShoeGazeBuilder/Assets.xcassets/AppIcon.appiconset/icon_256x256@2x.png b/Demo/ShoeGazeBuilder/Assets.xcassets/AppIcon.appiconset/icon_256x256@2x.png index 056c79a..70ad0fe 100644 Binary files a/Demo/ShoeGazeBuilder/Assets.xcassets/AppIcon.appiconset/icon_256x256@2x.png and b/Demo/ShoeGazeBuilder/Assets.xcassets/AppIcon.appiconset/icon_256x256@2x.png differ diff --git a/Demo/ShoeGazeBuilder/Assets.xcassets/AppIcon.appiconset/icon_32x32.png b/Demo/ShoeGazeBuilder/Assets.xcassets/AppIcon.appiconset/icon_32x32.png index 746cd1c..2dd8bc5 100644 Binary files a/Demo/ShoeGazeBuilder/Assets.xcassets/AppIcon.appiconset/icon_32x32.png and b/Demo/ShoeGazeBuilder/Assets.xcassets/AppIcon.appiconset/icon_32x32.png differ diff --git a/Demo/ShoeGazeBuilder/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x.png b/Demo/ShoeGazeBuilder/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x.png index 5a5997e..c5ca335 100644 Binary files a/Demo/ShoeGazeBuilder/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x.png and b/Demo/ShoeGazeBuilder/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x.png differ diff --git a/Demo/ShoeGazeBuilder/Assets.xcassets/AppIcon.appiconset/icon_512x512.png b/Demo/ShoeGazeBuilder/Assets.xcassets/AppIcon.appiconset/icon_512x512.png index 056c79a..70ad0fe 100644 Binary files a/Demo/ShoeGazeBuilder/Assets.xcassets/AppIcon.appiconset/icon_512x512.png and b/Demo/ShoeGazeBuilder/Assets.xcassets/AppIcon.appiconset/icon_512x512.png differ diff --git a/Demo/ShoeGazeBuilder/Assets.xcassets/AppIcon.appiconset/icon_512x512@2x.png b/Demo/ShoeGazeBuilder/Assets.xcassets/AppIcon.appiconset/icon_512x512@2x.png index 34c43a1..4204664 100644 Binary files a/Demo/ShoeGazeBuilder/Assets.xcassets/AppIcon.appiconset/icon_512x512@2x.png and b/Demo/ShoeGazeBuilder/Assets.xcassets/AppIcon.appiconset/icon_512x512@2x.png differ diff --git a/Demo/ShoeGazeBuilder/Info.plist b/Demo/ShoeGazeBuilder/Info.plist index 184302b..981f4b4 100644 --- a/Demo/ShoeGazeBuilder/Info.plist +++ b/Demo/ShoeGazeBuilder/Info.plist @@ -28,9 +28,9 @@ CFBundlePackageType APPL CFBundleShortVersionString - 2.1.3 + ${MARKETING_VERSION} CFBundleVersion - 11 + ${CURRENT_PROJECT_VERSION} LSApplicationCategoryType public.app-category.music LSMinimumSystemVersion diff --git a/Demo/ShoeGazeBuilderiOS.xcodeproj/project.pbxproj b/Demo/ShoeGazeBuilderiOS.xcodeproj/project.pbxproj index acc12b3..9583e9f 100644 --- a/Demo/ShoeGazeBuilderiOS.xcodeproj/project.pbxproj +++ b/Demo/ShoeGazeBuilderiOS.xcodeproj/project.pbxproj @@ -14,6 +14,7 @@ C3C10000000000000000000D /* LyrebirdUI in Frameworks */ = {isa = PBXBuildFile; productRef = C3C10000000000000000001C /* LyrebirdUI */; }; C3C10000000000000000001D /* Lyrebird in Frameworks */ = {isa = PBXBuildFile; productRef = C3C10000000000000000001E /* Lyrebird */; }; C3C100000000000000000031 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C3C100000000000000000030 /* Assets.xcassets */; }; + C3C1000000000000000000B1 /* SplashView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3C1000000000000000000B0 /* SplashView.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -22,6 +23,7 @@ C3C100000000000000000007 /* ShoeGazeBuilderiOSApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShoeGazeBuilderiOSApp.swift; sourceTree = ""; }; C3C100000000000000000008 /* ShoeGazeBuilderiOSAppModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShoeGazeBuilderiOSAppModel.swift; sourceTree = ""; }; C3C100000000000000000030 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + C3C1000000000000000000B0 /* SplashView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SplashView.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -60,6 +62,7 @@ children = ( C3C100000000000000000007 /* ShoeGazeBuilderiOSApp.swift */, C3C100000000000000000008 /* ShoeGazeBuilderiOSAppModel.swift */, + C3C1000000000000000000B0 /* SplashView.swift */, C3C100000000000000000030 /* Assets.xcassets */, C3C100000000000000000006 /* Info.plist */, ); @@ -100,7 +103,7 @@ attributes = { BuildIndependentTargetsInParallel = 1; LastSwiftUpdateCheck = 1600; - LastUpgradeCheck = 2620; + LastUpgradeCheck = 2660; TargetAttributes = { C3C100000000000000000011 = { CreatedOnToolsVersion = 16.0; @@ -147,6 +150,7 @@ files = ( C3C100000000000000000009 /* ShoeGazeBuilderiOSApp.swift in Sources */, C3C10000000000000000000A /* ShoeGazeBuilderiOSAppModel.swift in Sources */, + C3C1000000000000000000B1 /* SplashView.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -163,7 +167,6 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 7; DEBUG_INFORMATION_FORMAT = dwarf; - DEVELOPMENT_TEAM = HE5VJFE9E4; INFOPLIST_FILE = ShoeGazeBuilderiOS/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = ShoeGaze; INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.music"; @@ -192,7 +195,6 @@ CODE_SIGN_ENTITLEMENTS = ShoeGazeBuilderiOS/ShoeGazeBuilderiOS.entitlements; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 7; - DEVELOPMENT_TEAM = HE5VJFE9E4; INFOPLIST_FILE = ShoeGazeBuilderiOS/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = ShoeGaze; INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.music"; @@ -246,6 +248,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = dwarf; + DEVELOPMENT_TEAM = HE5VJFE9E4; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; ENABLE_USER_SCRIPT_SANDBOXING = YES; @@ -308,6 +311,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEVELOPMENT_TEAM = HE5VJFE9E4; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_USER_SCRIPT_SANDBOXING = YES; diff --git a/Demo/ShoeGazeBuilderiOS/Assets.xcassets/AppIcon.appiconset/icon_1024.png b/Demo/ShoeGazeBuilderiOS/Assets.xcassets/AppIcon.appiconset/icon_1024.png index b3eb3cf..d51fe2a 100644 Binary files a/Demo/ShoeGazeBuilderiOS/Assets.xcassets/AppIcon.appiconset/icon_1024.png and b/Demo/ShoeGazeBuilderiOS/Assets.xcassets/AppIcon.appiconset/icon_1024.png differ diff --git a/Demo/ShoeGazeBuilderiOS/Assets.xcassets/LaunchBackground.colorset/Contents.json b/Demo/ShoeGazeBuilderiOS/Assets.xcassets/LaunchBackground.colorset/Contents.json new file mode 100644 index 0000000..5b1da1e --- /dev/null +++ b/Demo/ShoeGazeBuilderiOS/Assets.xcassets/LaunchBackground.colorset/Contents.json @@ -0,0 +1,12 @@ +{ + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { "red" : "0.080", "green" : "0.070", "blue" : "0.060", "alpha" : "1.000" } + } + } + ], + "info" : { "author" : "xcode", "version" : 1 } +} diff --git a/Demo/ShoeGazeBuilderiOS/Assets.xcassets/SplashLogo.imageset/Contents.json b/Demo/ShoeGazeBuilderiOS/Assets.xcassets/SplashLogo.imageset/Contents.json new file mode 100644 index 0000000..d775b9a --- /dev/null +++ b/Demo/ShoeGazeBuilderiOS/Assets.xcassets/SplashLogo.imageset/Contents.json @@ -0,0 +1,8 @@ +{ + "images" : [ + { "idiom" : "universal", "filename" : "splashlogo.png", "scale" : "1x" }, + { "idiom" : "universal", "filename" : "splashlogo@2x.png", "scale" : "2x" }, + { "idiom" : "universal", "filename" : "splashlogo@3x.png", "scale" : "3x" } + ], + "info" : { "author" : "xcode", "version" : 1 } +} diff --git a/Demo/ShoeGazeBuilderiOS/Assets.xcassets/SplashLogo.imageset/splashlogo.png b/Demo/ShoeGazeBuilderiOS/Assets.xcassets/SplashLogo.imageset/splashlogo.png new file mode 100644 index 0000000..efd44e5 Binary files /dev/null and b/Demo/ShoeGazeBuilderiOS/Assets.xcassets/SplashLogo.imageset/splashlogo.png differ diff --git a/Demo/ShoeGazeBuilderiOS/Assets.xcassets/SplashLogo.imageset/splashlogo@2x.png b/Demo/ShoeGazeBuilderiOS/Assets.xcassets/SplashLogo.imageset/splashlogo@2x.png new file mode 100644 index 0000000..088f167 Binary files /dev/null and b/Demo/ShoeGazeBuilderiOS/Assets.xcassets/SplashLogo.imageset/splashlogo@2x.png differ diff --git a/Demo/ShoeGazeBuilderiOS/Assets.xcassets/SplashLogo.imageset/splashlogo@3x.png b/Demo/ShoeGazeBuilderiOS/Assets.xcassets/SplashLogo.imageset/splashlogo@3x.png new file mode 100644 index 0000000..296464b Binary files /dev/null and b/Demo/ShoeGazeBuilderiOS/Assets.xcassets/SplashLogo.imageset/splashlogo@3x.png differ diff --git a/Demo/ShoeGazeBuilderiOS/Info.plist b/Demo/ShoeGazeBuilderiOS/Info.plist index a68fee4..ae8b78c 100644 --- a/Demo/ShoeGazeBuilderiOS/Info.plist +++ b/Demo/ShoeGazeBuilderiOS/Info.plist @@ -59,7 +59,10 @@ UILaunchScreen - + + UIColorName + LaunchBackground + UIRequiresFullScreen UISupportedInterfaceOrientations diff --git a/Demo/ShoeGazeBuilderiOS/ShoeGazeBuilderiOSApp.swift b/Demo/ShoeGazeBuilderiOS/ShoeGazeBuilderiOSApp.swift index ee1a1fe..5b63045 100644 --- a/Demo/ShoeGazeBuilderiOS/ShoeGazeBuilderiOSApp.swift +++ b/Demo/ShoeGazeBuilderiOS/ShoeGazeBuilderiOSApp.swift @@ -20,21 +20,30 @@ import LyrebirdShoeGazeUI struct ShoeGazeBuilderiOSApp: App { @State private var model: ShoeGazeBuilderiOSAppModel = ShoeGazeBuilderiOSAppModel() + @State private var showSplash: Bool = true @Environment(\.scenePhase) private var scenePhase var body: some Scene { WindowGroup { - ShoeGazeBuilderView( - shoeGaze: model.shoeGaze, - library: model.library, - hardwareSampleRate: { model.hardwareSampleRate }, - onEnableLiveInput: { model.enableLiveInput() }, - midi: model.midi - ) - .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading) - .task { await model.startLibrary() } - .onDisappear { model.stop() } - .onOpenURL { url in model.importDocument(at: url) } + ZStack { + ShoeGazeBuilderView( + shoeGaze: model.shoeGaze, + library: model.library, + hardwareSampleRate: { model.hardwareSampleRate }, + onEnableLiveInput: { model.enableLiveInput() }, + midi: model.midi + ) + .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading) + .task { await model.startLibrary() } + .onDisappear { model.stop() } + .onOpenURL { url in model.importDocument(at: url) } + + if showSplash { + SplashView(isActive: $showSplash) + .transition(.opacity) + .zIndex(1) + } + } } .onChange(of: scenePhase) { _, phase in // Persist the rig whenever the app leaves the foreground. diff --git a/Demo/ShoeGazeBuilderiOS/SplashView.swift b/Demo/ShoeGazeBuilderiOS/SplashView.swift new file mode 100644 index 0000000..2f57f40 --- /dev/null +++ b/Demo/ShoeGazeBuilderiOS/SplashView.swift @@ -0,0 +1,82 @@ +// SplashView.swift +// Lyrebird +// +// Copyright (c) 2026 Joshua Parmenter / realizedsound +// SPDX-License-Identifier: MIT + +import SwiftUI + +/// Animated launch splash shown over the app on cold start. +/// +/// The native launch screen (`UILaunchScreen` → `LaunchBackground`) paints an instant dark +/// backdrop with no visible jump; this view then fades and scales the ShoeGaze pedal logo in, +/// holds briefly, and fades the whole overlay away to reveal ``ShoeGazeBuilderView``. Colors match +/// the app background so the hand-off is seamless. Respects Reduce Motion by skipping the scale. +struct SplashView: View { + + /// Background matching the builder's app background (`0.08, 0.07, 0.06`). + private static let backgroundColor: Color = Color(red: 0.08, green: 0.07, blue: 0.06) + + private static let logoSize: CGFloat = 200 + private static let logoCornerRadius: CGFloat = 44 + private static let logoStartScale: CGFloat = 0.86 + private static let wordmarkKerning: CGFloat = 4 + + private static let logoFadeInDuration: Double = 0.55 + private static let wordmarkFadeInDelay: Double = 0.30 + private static let wordmarkFadeInDuration: Double = 0.45 + private static let holdDuration: Double = 0.85 + private static let fadeOutDuration: Double = 0.45 + + @Environment(\.accessibilityReduceMotion) private var reduceMotion + + /// Set false to fade the overlay out; parent removes it when the fade completes. + @Binding var isActive: Bool + + @State private var logoOpacity: Double = 0 + @State private var logoScale: CGFloat = SplashView.logoStartScale + @State private var wordmarkOpacity: Double = 0 + + var body: some View { + ZStack { + SplashView.backgroundColor + .ignoresSafeArea() + + VStack(spacing: 22) { + Image("SplashLogo") + .resizable() + .scaledToFit() + .frame(width: SplashView.logoSize, height: SplashView.logoSize) + .clipShape(RoundedRectangle(cornerRadius: SplashView.logoCornerRadius, + style: .continuous)) + .opacity(logoOpacity) + .scaleEffect(logoScale) + + Text("ShoeGaze") + .font(.system(size: 34, weight: .semibold, design: .rounded)) + .kerning(SplashView.wordmarkKerning) + .foregroundStyle(.white) + .opacity(wordmarkOpacity) + } + } + .onAppear { runSequence() } + } + + private func runSequence() { + withAnimation(.easeOut(duration: SplashView.logoFadeInDuration)) { + logoOpacity = 1 + if !reduceMotion { logoScale = 1 } + } + withAnimation(.easeOut(duration: SplashView.wordmarkFadeInDuration) + .delay(SplashView.wordmarkFadeInDelay)) { + wordmarkOpacity = 1 + } + + let holdUntil: Double = SplashView.logoFadeInDuration + SplashView.holdDuration + DispatchQueue.main.asyncAfter(deadline: .now() + holdUntil) { + withAnimation(.easeIn(duration: SplashView.fadeOutDuration)) { + isActive = false + } + } + } +} diff --git a/Package.swift b/Package.swift index 7534837..4ae39b7 100644 --- a/Package.swift +++ b/Package.swift @@ -24,7 +24,7 @@ let package = Package( .library(name: "LyrebirdShoeGazeUI", targets: ["LyrebirdShoeGazeUI"]), ], dependencies: [ - .package(url: "https://realizedsound.mooo.com/josh/Lyrebird", from: "1.2.4"), + .package(url: "https://realizedsound.mooo.com/josh/Lyrebird", from: "1.6.3"), ], targets: [ // The core target depends on LyrebirdUI as well as the synthesis core: diff --git a/ShoeGaze.xcworkspace/xcshareddata/swiftpm/Package.resolved b/ShoeGaze.xcworkspace/xcshareddata/swiftpm/Package.resolved index 8567eb2..e8da3bb 100644 --- a/ShoeGaze.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/ShoeGaze.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "9786d88c1bf20540d8a635ebd8d373be29f0831e15ddefb3e92c9a5a87ea6e98", + "originHash" : "4c33c107b780400f6ccd69fd1203a485fca3ff6a90f93c3aad40bd403ef33702", "pins" : [ { "identity" : "linenoise-swift", @@ -15,8 +15,8 @@ "kind" : "remoteSourceControl", "location" : "https://realizedsound.mooo.com/josh/Lyrebird", "state" : { - "revision" : "63d6e0746fdedce626c9eff832e799bad949708e", - "version" : "1.2.4" + "revision" : "5e6534a615af6c075fc539e909cef3a63b038ced", + "version" : "1.6.3" } }, { diff --git a/Sources/LyrebirdShoeGazeUI/BoardFlowView.swift b/Sources/LyrebirdShoeGazeUI/BoardFlowView.swift index 93e7231..20ea682 100644 --- a/Sources/LyrebirdShoeGazeUI/BoardFlowView.swift +++ b/Sources/LyrebirdShoeGazeUI/BoardFlowView.swift @@ -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()) + } +} diff --git a/Sources/LyrebirdShoeGazeUI/PedalView.swift b/Sources/LyrebirdShoeGazeUI/PedalView.swift index a2f8cfe..4b22304 100644 --- a/Sources/LyrebirdShoeGazeUI/PedalView.swift +++ b/Sources/LyrebirdShoeGazeUI/PedalView.swift @@ -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) } }