Skip to content

Commit

Permalink
Refine cursor size
Browse files Browse the repository at this point in the history
  • Loading branch information
alfogrillo committed Oct 27, 2023
1 parent d4ae19a commit b4d6ce9
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ private struct WaveformInteractionModifier: ViewModifier {
let onSeek: (Double) -> Void

@ScaledMetric private var cursorVisibleWidth = 2.0
private let cursorInteractiveWidth: CGFloat = 50
@ScaledMetric private var cursorVisibleHeight = 24.0
private let cursorInteractiveSize: CGFloat = 50
private let feedbackGenerator = UISelectionFeedbackGenerator()

func body(content: Content) -> some View {
Expand All @@ -43,9 +44,10 @@ private struct WaveformInteractionModifier: ViewModifier {
})
.progressCursor(progress: progress) {
WaveformCursorView(color: .compound.iconAccentTertiary)
.frame(width: cursorVisibleWidth)
.frame(width: cursorVisibleWidth, height: cursorVisibleHeight)
.opacity(showCursor ? 1 : 0)
.frame(width: cursorInteractiveWidth)
.frame(width: cursorInteractiveSize)
.frame(maxHeight: cursorInteractiveSize)
.contentShape(Rectangle())
.gesture(DragGesture(coordinateSpace: .named(Self.namespaceName))
.updating(isDragging) { dragGesture, isDragging, _ in
Expand All @@ -55,7 +57,7 @@ private struct WaveformInteractionModifier: ViewModifier {
onSeek(max(0, min(progress, 1.0)))
}
)
.offset(x: -cursorInteractiveWidth / 2, y: 0)
.offset(x: -cursorInteractiveSize / 2, y: 0)
}
}
.coordinateSpace(name: Self.namespaceName)
Expand Down

0 comments on commit b4d6ce9

Please sign in to comment.