Open context menu from bottom-left corner when needed
This commit is contained in:
parent
8b55d0c20c
commit
18ff9a8127
@ -300,6 +300,7 @@ a.ignore {
|
|||||||
left: 0;
|
left: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
display: none;
|
display: none;
|
||||||
|
cursor: default;
|
||||||
}
|
}
|
||||||
|
|
||||||
.context-menu-entry {
|
.context-menu-entry {
|
||||||
@ -1299,6 +1300,13 @@ ContextMenuRenderer.prototype.onContextMenu = function(ev) {
|
|||||||
entry.classList.add('context-menu-entry');
|
entry.classList.add('context-menu-entry');
|
||||||
appendAny(this.element, entry);
|
appendAny(this.element, entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the bottom of the context menu is outside the viewport, move the context
|
||||||
|
// menu up, so that it appears to have opened from its bottom-left corner.
|
||||||
|
// + 1 pixel so that the pointer lands inside the element and turns on cursor: default
|
||||||
|
if(ev.clientY + this.element.offsetHeight > document.documentElement.clientHeight) {
|
||||||
|
this.element.style.top = (ev.clientY - this.element.offsetHeight + 1) + "px";
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ContextMenuRenderer.prototype.blur = function() {
|
ContextMenuRenderer.prototype.blur = function() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user