diff options
author | Devaev Maxim <[email protected]> | 2020-07-18 15:05:42 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2020-07-18 15:05:42 +0300 |
commit | b62271c112e26adc8d053a4f602acb84154c00cd (patch) | |
tree | 99c9b1cf07ff31a914234ed24f9f405a1873f89b /web/share/js/wm.js | |
parent | 1ae4d28eb0b4f432f635e9dda694d864c6baa1b8 (diff) |
fixed right menu position
Diffstat (limited to 'web/share/js/wm.js')
-rw-r--r-- | web/share/js/wm.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/web/share/js/wm.js b/web/share/js/wm.js index e53b8520..0ccffea5 100644 --- a/web/share/js/wm.js +++ b/web/share/js/wm.js @@ -197,6 +197,14 @@ function __WindowManager() { for (let el_button of __menu_buttons) { let el_menu = el_button.parentElement.querySelector(".menu"); if (el_button === el_a && window.getComputedStyle(el_menu, null).visibility === "hidden") { + let rect = el_menu.getBoundingClientRect(); + let offset = self.getViewGeometry().right - (rect.x + el_menu.clientWidth); + if (offset < 0) { + el_menu.style.right = "0px"; + } else { + el_menu.style.removeProperty("right"); + } + el_button.classList.add("menu-button-pressed"); el_menu.style.visibility = "visible"; el_menu.focus(); @@ -204,6 +212,8 @@ function __WindowManager() { } else { el_button.classList.remove("menu-button-pressed"); el_menu.style.visibility = "hidden"; + + el_menu.style.removeProperty("right"); } } |