Skip to content

Commit

Permalink
#132 make context menu fixed to prevent overlapping
Browse files Browse the repository at this point in the history
  • Loading branch information
bendera committed Dec 18, 2020
1 parent ea74823 commit 449889e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion web/contextMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,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;
Expand Down
4 changes: 2 additions & 2 deletions web/styles/contextMenu.css
Original file line number Diff line number Diff line change
@@ -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;
}
Expand Down

0 comments on commit 449889e

Please sign in to comment.