From fa63b0e516121c33f9147ece15a05357136cea5d Mon Sep 17 00:00:00 2001 From: Drew Weymouth Date: Tue, 25 Apr 2023 17:07:05 -0700 Subject: [PATCH] Fix #24: slider should only trigger play time update when being dragged --- ui/widgets/playercontrols.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ui/widgets/playercontrols.go b/ui/widgets/playercontrols.go index 0bcf265..ed9a90b 100644 --- a/ui/widgets/playercontrols.go +++ b/ui/widgets/playercontrols.go @@ -96,8 +96,10 @@ func NewPlayerControls() *PlayerControls { pc.totalTimeLabel.Alignment = fyne.TextAlignTrailing pc.slider.OnChanged = func(f float64) { - time := f * pc.totalTime - pc.curTimeLabel.SetText(util.SecondsToTimeString(time)) + if pc.slider.IsDragging() { + time := f * pc.totalTime + pc.curTimeLabel.SetText(util.SecondsToTimeString(time)) + } } pc.prev = widget.NewButtonWithIcon("", theme.MediaSkipPreviousIcon(), func() {}) @@ -138,8 +140,6 @@ func (pc *PlayerControls) SetPlaying(playing bool) { } 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 v := 0.0 if totalTime > 0 {