drag and drop init

This commit is contained in:
2026-02-10 01:55:49 -08:00
parent 9f0234e00e
commit ed9fcbe116
2 changed files with 62 additions and 7 deletions

View File

@@ -216,6 +216,28 @@ class PlayerStore {
}
}
move(fromIdx: number, toIdx: number) {
if (fromIdx === toIdx) return;
if (this.isShuffled) {
const indices = [...this.shuffledIndices];
if (fromIdx < 0 || fromIdx >= indices.length) return;
if (toIdx < 0 || toIdx >= indices.length) return;
const [item] = indices.splice(fromIdx, 1);
indices.splice(toIdx, 0, item);
this.shuffledIndices = indices;
} else {
const q = [...this.queue];
if (fromIdx < 0 || fromIdx >= q.length) return;
if (toIdx < 0 || toIdx >= q.length) return;
const [item] = q.splice(fromIdx, 1);
q.splice(toIdx, 0, item);
this.queue = q;
}
}
// Playback Controls
next() {