hide context menu on right click again

This commit is contained in:
geoffrey45
2022-03-14 08:42:19 +03:00
parent e3d86eac95
commit 8c2904192e
+9 -3
View File
@@ -4,16 +4,22 @@ import normalize from "../composables/normalizeContextMenu";
export default defineStore("context-menu", {
state: () => ({
visible: false,
options: [],
x: 0,
y: 0,
}),
actions: {
showContextMenu(e) {
this.visible = true;
showContextMenu(e, context_options) {
if (this.visible) {
this.visible = false;
return
}
this.options = context_options;
const yo = normalize(e.clientX, e.clientY);
this.x = yo.normalizedX;
this.y = yo.normalizedY;
console.log(yo);
this.visible = true;
},
hideContextMenu() {
this.visible = false;