Merge pull request #655 from stonerl/chapter-title-on-jump

Chapter title on jump
This commit is contained in:
Arkadiusz Fal
2024-05-16 18:16:24 +02:00
committed by GitHub
4 changed files with 13 additions and 4 deletions

View File

@@ -85,6 +85,14 @@ struct Seek: View {
.font(.system(size: playerControlsLayout.segmentFontSize))
.foregroundColor(getColor(for: category))
.padding(.bottom, 3)
case let .chapterSkip(chapter):
Divider()
Text(chapter)
.font(.system(size: playerControlsLayout.segmentFontSize))
.truncationMode(.tail)
.multilineTextAlignment(.center)
.foregroundColor(Color("AppRedColor"))
.padding(.bottom, 3)
default:
EmptyView()
}

View File

@@ -331,9 +331,9 @@ struct TimelineView: View {
}
var chaptersLayers: some View {
ForEach(chapters) { chapter in
ForEach(chapters.filter { $0.start != 0 }) { chapter in
RoundedRectangle(cornerRadius: 4)
.fill(Color.orange)
.fill(Color("AppRedColor"))
.frame(maxWidth: 2, maxHeight: height)
.offset(x: (chapter.start * oneUnitWidth) - 1)
}

View File

@@ -15,7 +15,7 @@ import SwiftUI
var body: some View {
Button(action: {
player.backend.seek(to: chapter.start, seekType: .userInteracted)
player.backend.seek(to: chapter.start, seekType: .chapterSkip(chapter.title))
}) {
Group {
verticalChapter
@@ -72,7 +72,7 @@ import SwiftUI
var body: some View {
Button {
player.backend.seek(to: chapter.start, seekType: .userInteracted)
player.backend.seek(to: chapter.start, seekType: .chapterSkip(chapter.title))
} label: {
Group {
horizontalChapter