flip contextmenu if too low

This commit is contained in:
joshuaboud 2021-06-04 14:25:46 -03:00
parent e36a0995fa
commit 2f987f790a
No known key found for this signature in database
GPG Key ID: 17EFB59E2A8BF50E

View File

@ -919,7 +919,13 @@ class NavContextMenu {
this.target = target;
this.dom_element.style.display = "inline";
this.dom_element.style.left = event.clientX + "px";
this.dom_element.style.top = event.clientY + "px";
var height = this.dom_element.getBoundingClientRect().height;
var max_height = window.innerHeight;
if (event.clientY > max_height - height) {
this.dom_element.style.top = event.clientY - height + "px";
} else {
this.dom_element.style.top = event.clientY + "px";
}
}
hide() {