Merge pull request #49 from nikandlv/development

Updated and fixed the queue logic
master
Nikan Dalvand 2019-08-03 22:15:29 +04:30 committed by GitHub
commit 58a6363e87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 3 deletions

View File

@ -34,7 +34,7 @@
</IconButton> </IconButton>
</div> </div>
</section> </section>
<section class="fullscreen" :class="{'active' : fullscreenStatus}"> <section class="fullscreen theme-background" :class="{'active' : fullscreenStatus}">
<IconButton variant="contained" :click="toggleFullscreenStatus"> <IconButton variant="contained" :click="toggleFullscreenStatus">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z"/><path d="M0 0h24v24H0z" fill="none"/></svg> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z"/><path d="M0 0h24v24H0z" fill="none"/></svg>
</IconButton> </IconButton>
@ -57,7 +57,8 @@ export default {
playingStatus: false, playingStatus: false,
isFavorited: false, isFavorited: false,
duration: '00:00', duration: '00:00',
isFullscreen: false isFullscreen: false,
updateCurrent: false
} }
}, },
computed: mapGetters(['fullscreenStatus', 'currentlyPlaying', 'playerQueue']), computed: mapGetters(['fullscreenStatus', 'currentlyPlaying', 'playerQueue']),
@ -65,7 +66,10 @@ export default {
this.drawVisualizer() this.drawVisualizer()
}, },
updated () { updated () {
this.wavesurfer.load(this.playerQueue[this.currentlyPlaying].stream) if (this.updateCurrent) {
this.wavesurfer.load(this.playerQueue[this.currentlyPlaying].stream)
this.updateCurrent = false
}
}, },
methods: { methods: {
drawVisualizer () { drawVisualizer () {
@ -155,6 +159,7 @@ export default {
onArtworkLoad () { onArtworkLoad () {
let img = this.$el.getElementsByTagName('img')[0] let img = this.$el.getElementsByTagName('img')[0]
let controlIcons = this.$el.getElementsByClassName('control-buttons')[0].children let controlIcons = this.$el.getElementsByClassName('control-buttons')[0].children
let themeBackground = this.$el.getElementsByClassName('theme-background')
color(img.src, (_, color) => { color(img.src, (_, color) => {
this.wavesurfer.setProgressColor(`#${color}`) this.wavesurfer.setProgressColor(`#${color}`)
this.wavesurfer.minimap.params.progressColor = `#${color}` this.wavesurfer.minimap.params.progressColor = `#${color}`
@ -181,6 +186,11 @@ export default {
controlIcons[child].style.backgroundColor = `#${color}` controlIcons[child].style.backgroundColor = `#${color}`
} }
} }
for (let item in themeBackground) {
if (typeof themeBackground[item] === 'object') {
themeBackground[item].style.backgroundColor = `#${color}`
}
}
}) })
}, },
playNext () { playNext () {
@ -189,6 +199,7 @@ export default {
map.style['height'] = '0%' map.style['height'] = '0%'
window.setTimeout(() => { window.setTimeout(() => {
this.playQueueItem(this.currentlyPlaying + 1) this.playQueueItem(this.currentlyPlaying + 1)
this.updateCurrent = true
}, 500) }, 500)
}, },
playPrevious () { playPrevious () {
@ -197,6 +208,7 @@ export default {
map.style['height'] = '0%' map.style['height'] = '0%'
window.setTimeout(() => { window.setTimeout(() => {
this.playQueueItem(this.currentlyPlaying - 1) this.playQueueItem(this.currentlyPlaying - 1)
this.updateCurrent = true
}, 500) }, 500)
}, },
play () { play () {

View File

@ -5,6 +5,7 @@ export default class HorizontalScrollPlugin extends Scrollbar.ScrollbarPlugin {
transformDelta (delta, fromEvent) { transformDelta (delta, fromEvent) {
const { x, y } = delta const { x, y } = delta
if (!this.scrollbar.options.horizontal) { if (!this.scrollbar.options.horizontal) {
console.log('wtf', x)
return { return {
y: y, y: y,
x: 0 x: 0