mirror of
https://github.com/yattee/yattee.git
synced 2026-04-10 01:26:57 +00:00
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:
@@ -12,11 +12,6 @@ struct SeekTimePreviewView: View {
|
||||
let seekTime: TimeInterval
|
||||
let buttonBackground: ButtonBackgroundStyle
|
||||
let theme: ControlsTheme
|
||||
let chapters: [VideoChapter]
|
||||
|
||||
private var currentChapter: VideoChapter? {
|
||||
chapters.last { $0.startTime <= seekTime }
|
||||
}
|
||||
|
||||
private var formattedTime: String {
|
||||
let totalSeconds = Int(seekTime)
|
||||
@@ -32,30 +27,18 @@ struct SeekTimePreviewView: View {
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
VStack(spacing: 4) {
|
||||
if let chapter = currentChapter {
|
||||
Text(chapter.title)
|
||||
.font(.caption)
|
||||
.fontWeight(.medium)
|
||||
.lineLimit(1)
|
||||
.truncationMode(.tail)
|
||||
.foregroundStyle(.white)
|
||||
.shadow(color: .black.opacity(0.8), radius: 2, x: 0, y: 1)
|
||||
}
|
||||
|
||||
Text(formattedTime)
|
||||
.font(.system(size: 16, weight: .medium))
|
||||
.monospacedDigit()
|
||||
.foregroundStyle(.white)
|
||||
}
|
||||
.padding(.vertical, 8)
|
||||
.padding(.horizontal, 12)
|
||||
.glassBackground(
|
||||
buttonBackground.glassStyle ?? .regular,
|
||||
in: .rect(cornerRadius: 8),
|
||||
fallback: .ultraThinMaterial,
|
||||
colorScheme: .dark
|
||||
)
|
||||
.shadow(radius: 4)
|
||||
Text(formattedTime)
|
||||
.font(.system(size: 16, weight: .medium))
|
||||
.monospacedDigit()
|
||||
.foregroundStyle(.white)
|
||||
.padding(.vertical, 8)
|
||||
.padding(.horizontal, 12)
|
||||
.glassBackground(
|
||||
buttonBackground.glassStyle ?? .regular,
|
||||
in: .rect(cornerRadius: 8),
|
||||
fallback: .ultraThinMaterial,
|
||||
colorScheme: .dark
|
||||
)
|
||||
.shadow(radius: 4)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user