drag and drop init
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user