diff options
author | Devaev Maxim <[email protected]> | 2018-08-13 08:36:52 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2018-08-13 08:36:52 +0300 |
commit | 8bd515b18dee4592ed53c9b90f503ec561604a17 (patch) | |
tree | 9d41a8b3ce5115a55360852c6de7b42abb9c1ad6 /kvmd | |
parent | b79b7e3975e9414b681c7511d7b5742ea6056320 (diff) |
fixed stream window centering
Diffstat (limited to 'kvmd')
-rw-r--r-- | kvmd/web/js/main.js | 4 | ||||
-rw-r--r-- | kvmd/web/js/stream.js | 3 | ||||
-rw-r--r-- | kvmd/web/js/ui.js | 16 |
3 files changed, 13 insertions, 10 deletions
diff --git a/kvmd/web/js/main.js b/kvmd/web/js/main.js index 9739fce5..fecfa2a6 100644 --- a/kvmd/web/js/main.js +++ b/kvmd/web/js/main.js @@ -1,6 +1,6 @@ function main() { var hid = new Hid(); + var ui = new Ui(hid); new Session(new Atx(), hid, new Msd()); - new Stream(); - new Ui(hid); + new Stream(ui); } diff --git a/kvmd/web/js/stream.js b/kvmd/web/js/stream.js index f1c5d950..8b6fe262 100644 --- a/kvmd/web/js/stream.js +++ b/kvmd/web/js/stream.js @@ -1,4 +1,4 @@ -function Stream() { +function Stream(ui) { // var self = this; /********************************************************************************/ @@ -69,6 +69,7 @@ function Stream() { var el_stream_image = $("stream-image"); el_stream_image.style.width = __normal_size.width * __size_factor + "px"; el_stream_image.style.height = __normal_size.height * __size_factor + "px"; + ui.showWindow($("stream-window")); }; var __refreshImage = function() { diff --git a/kvmd/web/js/ui.js b/kvmd/web/js/ui.js index c1e3cfc5..a2902395 100644 --- a/kvmd/web/js/ui.js +++ b/kvmd/web/js/ui.js @@ -1,10 +1,12 @@ function Ui(hid) { + var self = this; + + /********************************************************************************/ + var __top_z_index = 0; var __windows = []; var __ctl_items = []; - /********************************************************************************/ - var __init__ = function() { Array.prototype.forEach.call($$("ctl-item"), function(el_item) { el_item.onclick = () => __toggleMenu(el_item); @@ -56,16 +58,16 @@ function Ui(hid) { window.onmouseup = __globalMouseButtonHandler; // window.oncontextmenu = __globalMouseButtonHandler; - $("show-about-button").onclick = () => __showWindow($("about-window")); - $("show-keyboard-button").onclick = () => __showWindow($("keyboard-window")); - $("show-stream-button").onclick = () => __showWindow($("stream-window")); + $("show-about-button").onclick = () => self.showWindow($("about-window")); + $("show-keyboard-button").onclick = () => self.showWindow($("keyboard-window")); + $("show-stream-button").onclick = () => self.showWindow($("stream-window")); - __showWindow($("stream-window")); + self.showWindow($("stream-window")); }; /********************************************************************************/ - var __showWindow = function(el_window) { + self.showWindow = function(el_window) { if (!__isWindowOnPage(el_window) || el_window.hasAttribute("data-centered")) { var view = __getViewGeometry(); var rect = el_window.getBoundingClientRect(); |