less jank song-progress bar

This commit is contained in:
booploops 2021-12-08 19:35:11 -08:00
parent 43a50625a1
commit 4e7e28ef07
3 changed files with 374 additions and 352 deletions

View file

@ -65,7 +65,9 @@ const app = new Vue({
limit: 10
},
playerLCD: {
playbackDuration: 0
playbackDuration: 0,
desiredDuration: 0,
userInteraction: false
},
listennow: [],
radio: {
@ -290,6 +292,9 @@ const app = new Vue({
},
progressBarStyle () {
let val = this.playerLCD.playbackDuration
if(this.playerLCD.desiredDuration > 0) {
val = this.playerLCD.desiredDuration
}
let min = 0
let max = this.mk.currentPlaybackDuration
let value = (val-min)/(max-min)*100
@ -297,6 +302,13 @@ const app = new Vue({
'background': ('linear-gradient(to right, var(--keyColor) 0%, var(--keyColor) ' + value + '%, #333 ' + value + '%, #333 100%)')
}
},
getSongProgress() {
if(this.playerLCD.userInteraction) {
return this.playerLCD.desiredDuration
} else{
return this.playerLCD.playbackDuration
}
},
hashCode(str) {
var hash = 0, i, chr;
if (str.length === 0) return hash;