From 480695974e79f61c5515b1d7e611d40b2d7f5c37 Mon Sep 17 00:00:00 2001 From: geoffrey45 Date: Sat, 26 Mar 2022 12:35:08 +0300 Subject: [PATCH] fix child context-item click position - make child context menu scrollable if it has many items --- src/stores/context.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/stores/context.ts b/src/stores/context.ts index fb394c91..7eb34e38 100644 --- a/src/stores/context.ts +++ b/src/stores/context.ts @@ -12,13 +12,16 @@ export default defineStore("context-menu", { normalizedY: false, }), actions: { - showContextMenu(e: any, context_options: Option[]) { + showContextMenu(e: any, context_options: Promise) { if (this.visible) { this.visible = false; return; } - this.options = context_options; + context_options.then((options) => { + this.options = options; + }); + const yo = normalize(e.clientX, e.clientY); this.x = yo.normalX; @@ -36,7 +39,7 @@ export default defineStore("context-menu", { let result = false; this.options.forEach((option: Option) => { - if (option.children && option.children.length > 7) { + if (option.children && option.children.length > 9) { result = true; } });