From 65c0b4d78099903ca2d4f99b8bc26d529313ba53 Mon Sep 17 00:00:00 2001 From: bendera Date: Sun, 8 Nov 2020 02:25:26 +0100 Subject: [PATCH] #132 make context menu fixed to prevent overlapping --- web/contextMenu.ts | 2 +- web/styles/contextMenu.css | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/web/contextMenu.ts b/web/contextMenu.ts index 6a93ede5..deb27025 100644 --- a/web/contextMenu.ts +++ b/web/contextMenu.ts @@ -66,7 +66,7 @@ class ContextMenu { ? 2 - menuBounds.height // context menu fits above : -2 - (menuBounds.height - (frameBounds.height - (event.pageY - frameBounds.top))); // Overlap the context menu vertically with the cursor menu.style.left = (frameElem.scrollLeft + Math.max(event.pageX - frameBounds.left + relativeX, 2)) + 'px'; - menu.style.top = (frameElem.scrollTop + Math.max(event.pageY - frameBounds.top + relativeY, 2)) + 'px'; + menu.style.top = Math.max(event.clientY - frameBounds.top + relativeY, 2) + 'px'; menu.style.opacity = '1'; this.elem = menu; this.onClose = onClose; diff --git a/web/styles/contextMenu.css b/web/styles/contextMenu.css index d0e42b2f..76886360 100644 --- a/web/styles/contextMenu.css +++ b/web/styles/contextMenu.css @@ -1,13 +1,13 @@ .contextMenu{ display:block; - position:absolute; + position:fixed; background-color:var(--vscode-menu-background); box-shadow:0 1px 4px 1px var(--vscode-widget-shadow); color:var(--vscode-menu-foreground); list-style-type:none; margin:0; padding:4px 0; - z-index:10; + z-index:13; -webkit-user-select:none; user-select:none; }