diff options
Diffstat (limited to 'ui.js')
-rw-r--r-- | ui.js | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/ui.js b/ui.js index 6965331..15c0d34 100644 --- a/ui.js +++ b/ui.js @@ -115,7 +115,9 @@ class AppElement extends FocusElement { afterItem = this.playingTrack } - this.queueGrouplikeItem(item, afterItem) + this.queueGrouplikeItem(item, afterItem, { + movePlayingTrack: !shuffle + }) if (play) { this.playGrouplikeItem(item) @@ -436,7 +438,7 @@ class AppElement extends FocusElement { this.player.kill() } - async queueGrouplikeItem(topItem, afterItem = null) { + async queueGrouplikeItem(topItem, afterItem = null, {movePlayingTrack = true} = {}) { const newTrackIndex = this.queueGrouplike.items.length const recursivelyAddTracks = item => { @@ -458,6 +460,12 @@ class AppElement extends FocusElement { // is needed to fix the display, but then you end up with a new object // that doesn't work with indexOf).) if (items.includes(item)) { + // HOWEVER, if the "moveCurrentTrack" option is false, and that item + // is the one that's currently playing, we won't do anything with it + // at all. + if (!movePlayingTrack && item === this.playingTrack) { + return + } items.splice(items.indexOf(item), 1) } |