feat: replace context menu items splicing with implementation of context menu item sections
This commit is contained in:
parent
c9bbd10af1
commit
0f02142eb1
9 changed files with 85 additions and 50 deletions
|
@ -1,17 +1,17 @@
|
|||
import { render } from "vue";
|
||||
import ContextMenu from "~/components/UserInterface/ContextMenu.vue";
|
||||
import type { ContextMenuInterface, ContextMenuItem } from "~/types/interfaces";
|
||||
import type { ContextMenuInterface, ContextMenuItem, ContextMenuSection } from "~/types/interfaces";
|
||||
|
||||
export default (e: MouseEvent | PointerEvent, contextMenu: ContextMenuInterface, menuItems: ContextMenuItem[]) => {
|
||||
export default (e: MouseEvent | PointerEvent, contextMenu: ContextMenuInterface, sections: ContextMenuSection[]) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
console.log("Menu items:", menuItems);
|
||||
if (menuItems.length) {
|
||||
console.log("Menu sections:", sections);
|
||||
if (sections.length) {
|
||||
console.log("Showing context menu");
|
||||
contextMenu.show = true;
|
||||
contextMenu.pointerX = e.clientX;
|
||||
contextMenu.pointerY = e.clientY;
|
||||
contextMenu.items = menuItems;
|
||||
contextMenu.sections = sections;
|
||||
console.log("Showed");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue