submenu closes when click outside

This commit is contained in:
2022-12-10 10:45:34 +01:00
parent 83c14b8001
commit 6004651963
4 changed files with 46 additions and 30 deletions

View File

@ -34,6 +34,7 @@ export const globalStore = defineStore("globalStore", {
draw2dLast: false,
reset: false,
canDraw: true,
activeSubMenu: "",
};
},
actions: {
@ -46,14 +47,17 @@ export const globalStore = defineStore("globalStore", {
);
},
toggleDraw1d() {
this.setActiveSubMenu("");
this.draw1d = true;
},
toggleDraw2d() {
this.setActiveSubMenu("");
this.toggleStop();
this.canDraw = true;
this.draw2d = true;
},
toggleDraw2dLast() {
this.setActiveSubMenu("");
this.toggleStop();
this.canDraw = true;
this.draw2dLast = true;
@ -68,5 +72,9 @@ export const globalStore = defineStore("globalStore", {
this.draw2dLast = false;
this.canDraw = false;
},
setActiveSubMenu(data) {
if (this.activeSubMenu == data) this.activeSubMenu = "";
else this.activeSubMenu = data;
},
},
});