feat: make use of useState to show and hide context menu rather than manually rendering and unrendering

This commit is contained in:
SauceyRed 2025-07-30 16:26:06 +02:00
parent a146eb001a
commit 78d43ca0c8
Signed by: sauceyred
GPG key ID: 2BF92EB6D8A5CCA7
7 changed files with 47 additions and 29 deletions

12
utils/showContextMenu.ts Normal file
View file

@ -0,0 +1,12 @@
import { render } from "vue";
import ContextMenu from "~/components/UserInterface/ContextMenu.vue";
import type { ContextMenuInterface, ContextMenuItem } from "~/types/interfaces";
export default (e: MouseEvent, contextMenu: ContextMenuInterface, menuItems: ContextMenuItem[]) => {
console.log("Showing context menu");
contextMenu.show = true;
contextMenu.cursorX = e.clientX;
contextMenu.cursorY = e.clientY;
contextMenu.items = menuItems;
console.log("Showed");
}