mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 04:23:01 +00:00
responsiveness improvements
+ extract track context menu handler into a composable
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import { Ref } from "vue";
|
||||
|
||||
import useModalStore from "@/stores/modal";
|
||||
import useQueueStore from "@/stores/queue";
|
||||
import useContextStore from "@/stores/context";
|
||||
|
||||
import { ContextSrc } from "./enums";
|
||||
import { Track } from "@/interfaces";
|
||||
import trackContext from "@/contexts/track_context";
|
||||
|
||||
export const showTrackContextMenu = (
|
||||
e: Event,
|
||||
track: Track,
|
||||
flag: Ref<boolean>
|
||||
) => {
|
||||
const menu = useContextStore();
|
||||
|
||||
const options = trackContext(track, useModalStore, useQueueStore);
|
||||
|
||||
menu.showContextMenu(e, options, ContextSrc.Track);
|
||||
flag.value = true;
|
||||
|
||||
menu.$subscribe((mutation, state) => {
|
||||
if (!state.visible) {
|
||||
flag.value = false;
|
||||
}
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user