1
0
mirror of https://github.com/yattee/yattee.git synced 2025-04-28 07:50:33 +05:30

Fix scrubbing area

This commit is contained in:
Arkadiusz Fal 2023-07-22 21:30:57 +02:00
parent 52dad5942e
commit 4cabfb7733

View File

@ -103,7 +103,9 @@ struct TimelineView: View {
.foregroundColor(.white) .foregroundColor(.white)
} }
#if os(tvOS)
.frame(maxHeight: 300, alignment: .bottom) .frame(maxHeight: 300, alignment: .bottom)
#endif
.offset(x: thumbTooltipOffset) .offset(x: thumbTooltipOffset)
.overlay(GeometryReader { proxy in .overlay(GeometryReader { proxy in
Color.clear Color.clear
@ -114,8 +116,9 @@ struct TimelineView: View {
tooltipSize = proxy.size tooltipSize = proxy.size
} }
}) })
#if os(tvOS)
.frame(height: 80) .frame(height: 80)
#endif
.opacity(dragging ? 1 : 0) .opacity(dragging ? 1 : 0)
.animation(.easeOut, value: thumbTooltipOffset) .animation(.easeOut, value: thumbTooltipOffset)
HStack(spacing: 4) { HStack(spacing: 4) {
@ -161,14 +164,6 @@ struct TimelineView: View {
self.size = size self.size = size
} }
}) })
.frame(maxHeight: playerControlsLayout.timelineHeight)
#if !os(tvOS)
.gesture(DragGesture(minimumDistance: 0).onEnded { value in
let target = (value.location.x / size.width) * units
self.playerTime.currentTime = .secondsInDefaultTimescale(target)
player.backend.seek(to: target, seekType: .userInteracted)
})
#endif
durationView durationView
.shadow(radius: 3) .shadow(radius: 3)
@ -177,8 +172,14 @@ struct TimelineView: View {
.frame(minWidth: 30, alignment: .trailing) .frame(minWidth: 30, alignment: .trailing)
.clipShape(RoundedRectangle(cornerRadius: 4)) .clipShape(RoundedRectangle(cornerRadius: 4))
} }
#if !os(tvOS)
.highPriorityGesture( .font(.system(size: playerControlsLayout.timeFontSize).monospacedDigit())
.zIndex(2)
.foregroundColor(.white)
}
.contentShape(Rectangle())
#if !os(tvOS)
.gesture(
DragGesture(minimumDistance: 5, coordinateSpace: .global) DragGesture(minimumDistance: 5, coordinateSpace: .global)
.onChanged { value in .onChanged { value in
if !dragging { if !dragging {
@ -210,11 +211,7 @@ struct TimelineView: View {
controls.resetTimer() controls.resetTimer()
} }
) )
#endif #endif
.font(.system(size: playerControlsLayout.timeFontSize).monospacedDigit())
.zIndex(2)
.foregroundColor(.white)
}
} }
@ViewBuilder var durationView: some View { @ViewBuilder var durationView: some View {