Files
swingmusic-extended/src/stores/context.js
T
geoffrey45 658e7cdbb7 move global search input to a general location
- create a global search store
- create a half-baked context menu store
-
2022-03-12 08:56:38 +03:00

22 lines
486 B
JavaScript

import { defineStore } from "pinia";
import normalizeContextMenu from "../composables/normalizeContextMenu";
export default defineStore("context-menu", {
state: () => ({
visible: false,
x: 0,
y: 0,
}),
actions: {
showContextMenu(e) {
this.visible = true;
const { normalX, normalY } = normalizeContextMenu(e.clientX, e.clientY);
this.x = normalX;
this.y = normalY;
},
hideContextMenu() {
this.visible = false;
},
},
});