Fixed #52: Added shuffling controls

merge-requests/154/head
Eliot Berriot 2017-12-17 17:23:29 +01:00
rodzic f6c939db4c
commit cd1c3ca379
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: DD6965E2476E5C27
3 zmienionych plików z 20 dodań i 2 usunięć

Wyświetl plik

@ -9,6 +9,7 @@ Changelog
as a favorite (#53)
- Shortcuts: avoid collisions between shortcuts by using the exact modifier (#53)
- Player: Added looping controls and shortcuts (#52)
- Player: Added shuffling controls and shortcuts (#52)
0.2.6 (2017-12-15)

Wyświetl plik

@ -1,10 +1,12 @@
import Vue from 'vue'
import _ from 'lodash'
import logger from '@/logging'
import cache from '@/cache'
import config from '@/config'
import Audio from '@/audio'
import backend from '@/audio/backend'
import radios from '@/radios'
import Vue from 'vue'
import url from '@/utils/url'
import auth from '@/auth'
@ -316,6 +318,13 @@ class Queue {
}
}
shuffle () {
let tracks = this.tracks
let shuffled = _.shuffle(tracks)
this.clean()
this.appendMany(shuffled)
}
}
let queue = new Queue()

Wyświetl plik

@ -97,7 +97,14 @@
class="repeat orange secondary icon">
</i>
</div>
<div class="three wide column"></div>
<div
@click="queue.shuffle()"
:disabled="queue.tracks.length === 0"
title="Shuffle your queue"
class="two wide column control">
<i :class="['ui', 'random', 'secondary', {'disabled': queue.tracks.length === 0}, 'icon']" ></i>
</div>
<div class="one wide column"></div>
<div
@click="queue.clean()"
:disabled="queue.tracks.length === 0"
@ -114,6 +121,7 @@
@keydown.ctrl.up.prevent.exact="queue.incrementVolume(0.1)"
@keydown.f.prevent.exact="favoriteTracks.toggle(queue.currentTrack.id)"
@keydown.l.prevent.exact="queue.toggleLooping"
@keydown.s.prevent.exact="queue.shuffle"
/>
</div>