From 20fedf67ae68e6c00952a1b2b8d83b8d1e484880 Mon Sep 17 00:00:00 2001 From: Drew Weymouth Date: Sat, 25 May 2024 08:46:49 -0700 Subject: [PATCH] disable playback slider when nothing playing --- ui/widgets/playercontrols.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ui/widgets/playercontrols.go b/ui/widgets/playercontrols.go index 9719160..d71237d 100644 --- a/ui/widgets/playercontrols.go +++ b/ui/widgets/playercontrols.go @@ -114,6 +114,7 @@ func NewPlayerControls() *PlayerControls { pc.ExtendBaseWidget(pc) pc.slider = NewTrackPosSlider() + pc.slider.Disable() pc.curTimeLabel = NewLabelMinSize(util.SecondsToTimeString(0), 55) pc.curTimeLabel.Alignment = fyne.TextAlignTrailing pc.totalTimeLabel = NewLabelMinSize(util.SecondsToTimeString(0), 55) @@ -182,6 +183,11 @@ func (pc *PlayerControls) UpdatePlayTime(curTime, totalTime float64) { pc.totalTimeLabel.SetText(tt) updated = true } + if totalTime > 0 { + pc.slider.Enable() + } else { + pc.slider.Disable() + } if !pc.slider.IsDragging() { ct := util.SecondsToTimeString(curTime) if ct != pc.curTimeLabel.Text {