mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 04:23:01 +00:00
feat: add a cranky scroll to current in queue method
+ fix: media notification image url
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { Ref } from "vue";
|
||||
import { focusElem } from "@/utils";
|
||||
import { paths } from "@/config";
|
||||
import { defineStore } from "pinia";
|
||||
@@ -38,11 +39,18 @@ export default defineStore("Queue", {
|
||||
playing: false,
|
||||
from: {} as From,
|
||||
tracklist: [] as Track[],
|
||||
queueScrollFunction: (index: number) => {},
|
||||
mousover: <Ref | null>null,
|
||||
}),
|
||||
actions: {
|
||||
play(index: number = 0) {
|
||||
if (this.tracklist.length === 0) return;
|
||||
this.currentindex = index;
|
||||
|
||||
if (!this.mousover) {
|
||||
this.queueScrollFunction(this.currentindex - 1);
|
||||
}
|
||||
|
||||
const track = this.tracklist[index];
|
||||
this.currentid = track.trackid;
|
||||
const uri = `${paths.api.files}/${track.hash}`;
|
||||
@@ -237,6 +245,13 @@ export default defineStore("Queue", {
|
||||
removeFromQueue(index: number = 0) {
|
||||
this.tracklist.splice(index, 1);
|
||||
},
|
||||
setQueueFunction(
|
||||
cb: (index: number) => void,
|
||||
mousover: Ref<boolean> | null
|
||||
) {
|
||||
this.queueScrollFunction = cb;
|
||||
this.mousover = mousover;
|
||||
},
|
||||
},
|
||||
getters: {
|
||||
next(): Track {
|
||||
|
||||
Reference in New Issue
Block a user