Minor controls changes

This commit is contained in:
Arkadiusz Fal 2022-12-03 15:33:32 +01:00
parent 779bf190f4
commit 909f035399
3 changed files with 8 additions and 5 deletions

View File

@ -3,7 +3,7 @@ import Foundation
import SwiftUI import SwiftUI
final class ControlOverlaysModel: ObservableObject { final class ControlOverlaysModel: ObservableObject {
static let animation = Animation.easeInOut(duration: 0.2) static let animation = Animation.easeInOut(duration: 0.1)
static let shared = ControlOverlaysModel() static let shared = ControlOverlaysModel()
@Published private(set) var presenting = false { didSet { handlePresentationChange() } } @Published private(set) var presenting = false { didSet { handlePresentationChange() } }

View File

@ -453,7 +453,7 @@ struct PlayerControls: View {
width _: Double? = nil, width _: Double? = nil,
height _: Double? = nil, height _: Double? = nil,
cornerRadius: Double = 3, cornerRadius: Double = 3,
background: Bool = true, background: Bool = false,
foregroundColor: Color? = nil, foregroundColor: Color? = nil,
active: Bool = false, active: Bool = false,
action: @escaping () -> Void = {} action: @escaping () -> Void = {}
@ -486,6 +486,7 @@ struct PlayerControls: View {
.frame(width: size ?? playerControlsLayout.buttonSize, height: size ?? playerControlsLayout.buttonSize) .frame(width: size ?? playerControlsLayout.buttonSize, height: size ?? playerControlsLayout.buttonSize)
.modifier(ControlBackgroundModifier(enabled: useBackground)) .modifier(ControlBackgroundModifier(enabled: useBackground))
.clipShape(RoundedRectangle(cornerRadius: cornerRadius)) .clipShape(RoundedRectangle(cornerRadius: cornerRadius))
.environment(\.colorScheme, .dark)
} }
} }

View File

@ -124,7 +124,7 @@ struct TimelineView: View {
.frame(minWidth: 35) .frame(minWidth: 35)
.padding(.leading, playerControlsLayout.timeLeadingEdgePadding) .padding(.leading, playerControlsLayout.timeLeadingEdgePadding)
.padding(.trailing, playerControlsLayout.timeTrailingEdgePadding) .padding(.trailing, playerControlsLayout.timeTrailingEdgePadding)
.modifier(ControlBackgroundModifier()) .shadow(radius: 3)
.clipShape(RoundedRectangle(cornerRadius: 4)) .clipShape(RoundedRectangle(cornerRadius: 4))
ZStack { ZStack {
@ -171,10 +171,10 @@ struct TimelineView: View {
#endif #endif
durationView durationView
.shadow(radius: 3)
.padding(.leading, playerControlsLayout.timeTrailingEdgePadding) .padding(.leading, playerControlsLayout.timeTrailingEdgePadding)
.padding(.trailing, playerControlsLayout.timeLeadingEdgePadding) .padding(.trailing, playerControlsLayout.timeLeadingEdgePadding)
.frame(minWidth: 30, alignment: .trailing) .frame(minWidth: 30, alignment: .trailing)
.modifier(ControlBackgroundModifier())
.clipShape(RoundedRectangle(cornerRadius: 4)) .clipShape(RoundedRectangle(cornerRadius: 4))
} }
#if !os(tvOS) #if !os(tvOS)
@ -213,6 +213,7 @@ struct TimelineView: View {
#endif #endif
.font(.system(size: playerControlsLayout.timeFontSize).monospacedDigit()) .font(.system(size: playerControlsLayout.timeFontSize).monospacedDigit())
.zIndex(2) .zIndex(2)
.foregroundColor(.white)
} }
} }
@ -319,7 +320,7 @@ struct TimelineView: View {
ForEach(chapters) { chapter in ForEach(chapters) { chapter in
RoundedRectangle(cornerRadius: 4) RoundedRectangle(cornerRadius: 4)
.fill(Color.orange) .fill(Color.orange)
.frame(maxWidth: 2, maxHeight: 12) .frame(maxWidth: 2, maxHeight: height)
.offset(x: (chapter.start * oneUnitWidth) - 1) .offset(x: (chapter.start * oneUnitWidth) - 1)
} }
} }
@ -376,6 +377,7 @@ struct TimelineView_Previews: PreviewProvider {
return VStack(spacing: 40) { return VStack(spacing: 40) {
TimelineView() TimelineView()
} }
.background(Color.black)
.padding() .padding()
} }
} }