Add separate glass capsule for chapter title above seek preview

Extract chapter title from inside the storyboard preview into a
standalone ChapterCapsuleView with its own glass capsule background.
The capsule follows the seek position horizontally but independently
clamps to screen edges using alignmentGuide, allowing it to be wider
than the storyboard thumbnail without going offscreen.
This commit is contained in:
Arkadiusz Fal
2026-03-28 14:00:48 +01:00
parent 3d1974930b
commit e50817c043
5 changed files with 133 additions and 78 deletions

View File

@@ -20,20 +20,31 @@ struct GestureSeekPreviewView: View {
let theme: ControlsTheme
let chapters: [VideoChapter]
let isActive: Bool
var availableWidth: CGFloat = 320
@State private var opacity: Double = 0
private var currentChapter: VideoChapter? {
chapters.last { $0.startTime <= seekTime }
}
var body: some View {
Group {
// Only show if storyboard is available
VStack(spacing: 6) {
if let chapter = currentChapter {
ChapterCapsuleView(
title: chapter.title,
buttonBackground: buttonBackground
)
.frame(maxWidth: availableWidth - 16)
}
if let storyboard {
SeekPreviewView(
storyboard: storyboard,
seekTime: seekTime,
storyboardService: storyboardService,
buttonBackground: buttonBackground,
theme: theme,
chapters: chapters
theme: theme
)
}
}