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;