Add a progress indicator to voice message preview (#1956)

This commit is contained in:
Nicolas Mauri
2023-10-25 12:27:00 +02:00
committed by GitHub
parent 1ba6fb0a60
commit 30b18031a0
7 changed files with 112 additions and 17 deletions
@@ -74,18 +74,13 @@ struct VoiceMessageRoomPlaybackView: View {
.monospacedDigit()
.fixedSize(horizontal: true, vertical: true)
}
GeometryReader { geometry in
waveformView
.overlay(alignment: .leading) {
// Display a cursor
RoundedRectangle(cornerRadius: 1)
.fill(Color.compound.iconAccentTertiary)
.offset(CGSize(width: playerState.progress * geometry.size.width, height: 0.0))
.frame(width: waveformLineWidth, height: geometry.size.height)
.opacity(showWaveformCursor ? 1 : 0)
}
.waveformDragGesture($dragState)
}
waveformView
.waveformDragGesture($dragState)
.progressCursor(progress: playerState.progress) {
WaveformCursorView(color: .compound.iconAccentTertiary)
.opacity(showWaveformCursor ? 1 : 0)
.frame(width: waveformLineWidth)
}
}
.onChange(of: dragState) { newDragState in
switch newDragState {