disable playback slider when nothing playing

This commit is contained in:
Drew Weymouth
2024-05-25 08:46:49 -07:00
parent d08b563b8c
commit 20fedf67ae
+6
View File
@@ -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 {