diff options
author | Devaev Maxim <[email protected]> | 2018-07-29 13:31:15 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2018-07-29 13:31:15 +0300 |
commit | 72e5e49889cc9da0a674c5a35a75776d466ae2a6 (patch) | |
tree | 459bda6b28f0751248704065f778bc397e6707eb /kvmd | |
parent | 0c8f8bc131ad2a295bc91544f3b12fe1d98358bc (diff) |
close menues on start dragging windows
Diffstat (limited to 'kvmd')
-rw-r--r-- | kvmd/web/js/ui.js | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/kvmd/web/js/ui.js b/kvmd/web/js/ui.js index d3bf6b14..088a7253 100644 --- a/kvmd/web/js/ui.js +++ b/kvmd/web/js/ui.js @@ -101,18 +101,28 @@ var ui = new function() { }); if (all_hidden) { - __raiseLastWindow(); document.onkeyup = null; + __raiseLastWindow(); } else { document.onkeyup = function(event) { if (event.code == "Escape") { event.preventDefault(); - __toggleMenu(null); + __closeAllMenues(); + __raiseLastWindow(); } } } }; + var __closeAllMenues = function() { + document.onkeyup = null; + __ctl_items.forEach(function(el_item) { + var el_menu = el_item.parentElement.querySelector(".ctl-dropdown-content"); + el_item.classList.remove("ctl-item-selected"); + el_menu.style.display = "none"; + }); + }; + var __globalMouseButtonHandler = function(event) { hid.updateLeds(); if (!event.target.matches(".ctl-item")) { @@ -124,7 +134,8 @@ var ui = new function() { return; } } - __toggleMenu(null); + __closeAllMenues(); + __raiseLastWindow(); } }; @@ -133,6 +144,7 @@ var ui = new function() { var prev_y = 0; function startMoving(event) { + __closeAllMenues(); __raiseWindow(el_window); event = (event || window.event); event.preventDefault(); |