Allow reordering upcoming tracks in the queue by drag and drop

This commit is contained in:
2026-09-23 22:10:21 +02:00
parent 2cb560fda4
commit 2fe26b15dd
2 changed files with 70 additions and 14 deletions
@@ -456,6 +456,16 @@ class PlayerState {
this.#loadCurrent();
}
moveQueueItem(from: number, insertAt: number) {
if (from < 0 || from >= this.tracks.length) return;
const target = insertAt > from ? insertAt - 1 : insertAt;
if (target === from) return;
const tracks = [...this.tracks];
const [item] = tracks.splice(from, 1);
tracks.splice(target, 0, item);
this.tracks = tracks;
}
clearUpcoming() {
this.tracks = this.currentId === null ? [] : [this.current];
}