Fix #24: slider should only trigger play time update when being dragged

This commit is contained in:
Drew Weymouth
2023-04-25 17:07:05 -07:00
parent 02e51e5aa2
commit fa63b0e516
+4 -4
View File
@@ -96,8 +96,10 @@ func NewPlayerControls() *PlayerControls {
pc.totalTimeLabel.Alignment = fyne.TextAlignTrailing pc.totalTimeLabel.Alignment = fyne.TextAlignTrailing
pc.slider.OnChanged = func(f float64) { pc.slider.OnChanged = func(f float64) {
time := f * pc.totalTime if pc.slider.IsDragging() {
pc.curTimeLabel.SetText(util.SecondsToTimeString(time)) time := f * pc.totalTime
pc.curTimeLabel.SetText(util.SecondsToTimeString(time))
}
} }
pc.prev = widget.NewButtonWithIcon("", theme.MediaSkipPreviousIcon(), func() {}) pc.prev = widget.NewButtonWithIcon("", theme.MediaSkipPreviousIcon(), func() {})
@@ -138,8 +140,6 @@ func (pc *PlayerControls) SetPlaying(playing bool) {
} }
func (pc *PlayerControls) UpdatePlayTime(curTime, totalTime float64) { func (pc *PlayerControls) UpdatePlayTime(curTime, totalTime float64) {
// TODO: there is a bug with very long tracks (~20min) where the
// curtime label will bounce back and forth +- 1sec (rounding issue?)
pc.totalTime = totalTime pc.totalTime = totalTime
v := 0.0 v := 0.0
if totalTime > 0 { if totalTime > 0 {