update slider once per second always
This commit is contained in:
@@ -148,9 +148,8 @@ func (pc *PlayerControls) doPlayTimeUpdate(curTime, totalTime float64) {
|
||||
pc.curTimeLabel.SetText(ct)
|
||||
updated = true
|
||||
}
|
||||
if totalTime < 210 || updated {
|
||||
// if current track is long, we only need to redraw the slider
|
||||
// when the time label updates, to reduce screen redraws.
|
||||
if updated {
|
||||
// Only update slider once a second when time label changes
|
||||
pc.slider.SetValue(v)
|
||||
}
|
||||
}
|
||||
|
||||
+5
-2
@@ -1,13 +1,16 @@
|
||||
package ui
|
||||
|
||||
import "fmt"
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
)
|
||||
|
||||
func SecondsToTimeString(s float64) string {
|
||||
if s < 0 {
|
||||
s = 0
|
||||
}
|
||||
min := int(s / 60)
|
||||
sec := int(s - float64(min*60))
|
||||
sec := int(math.Round(s - float64(min*60)))
|
||||
|
||||
return fmt.Sprintf("%2d:%02d", min, sec)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user