From 8c2904192e4e65e0f37d358b0d615a479756614e Mon Sep 17 00:00:00 2001 From: geoffrey45 Date: Mon, 14 Mar 2022 08:42:19 +0300 Subject: [PATCH] hide context menu on right click again --- src/stores/context.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/stores/context.js b/src/stores/context.js index 94199b13..a172bc45 100644 --- a/src/stores/context.js +++ b/src/stores/context.js @@ -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;