mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 21:43:41 +00:00
Merge pull request #655 from stonerl/chapter-title-on-jump
Chapter title on jump
This commit is contained in:
commit
68f3d5c631
@ -1,6 +1,7 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
enum SeekType: Equatable {
|
enum SeekType: Equatable {
|
||||||
|
case chapterSkip(String)
|
||||||
case segmentSkip(String)
|
case segmentSkip(String)
|
||||||
case segmentRestore
|
case segmentRestore
|
||||||
case userInteracted
|
case userInteracted
|
||||||
|
@ -85,6 +85,14 @@ struct Seek: View {
|
|||||||
.font(.system(size: playerControlsLayout.segmentFontSize))
|
.font(.system(size: playerControlsLayout.segmentFontSize))
|
||||||
.foregroundColor(getColor(for: category))
|
.foregroundColor(getColor(for: category))
|
||||||
.padding(.bottom, 3)
|
.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:
|
default:
|
||||||
EmptyView()
|
EmptyView()
|
||||||
}
|
}
|
||||||
|
@ -331,9 +331,9 @@ struct TimelineView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var chaptersLayers: some View {
|
var chaptersLayers: some View {
|
||||||
ForEach(chapters) { chapter in
|
ForEach(chapters.filter { $0.start != 0 }) { chapter in
|
||||||
RoundedRectangle(cornerRadius: 4)
|
RoundedRectangle(cornerRadius: 4)
|
||||||
.fill(Color.orange)
|
.fill(Color("AppRedColor"))
|
||||||
.frame(maxWidth: 2, maxHeight: height)
|
.frame(maxWidth: 2, maxHeight: height)
|
||||||
.offset(x: (chapter.start * oneUnitWidth) - 1)
|
.offset(x: (chapter.start * oneUnitWidth) - 1)
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ import SwiftUI
|
|||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
Button(action: {
|
Button(action: {
|
||||||
player.backend.seek(to: chapter.start, seekType: .userInteracted)
|
player.backend.seek(to: chapter.start, seekType: .chapterSkip(chapter.title))
|
||||||
}) {
|
}) {
|
||||||
Group {
|
Group {
|
||||||
verticalChapter
|
verticalChapter
|
||||||
@ -72,7 +72,7 @@ import SwiftUI
|
|||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
Button {
|
Button {
|
||||||
player.backend.seek(to: chapter.start, seekType: .userInteracted)
|
player.backend.seek(to: chapter.start, seekType: .chapterSkip(chapter.title))
|
||||||
} label: {
|
} label: {
|
||||||
Group {
|
Group {
|
||||||
horizontalChapter
|
horizontalChapter
|
||||||
|
Loading…
Reference in New Issue
Block a user