fixed stream window centering

This commit is contained in:
Devaev Maxim 2018-08-13 08:36:52 +03:00
parent b79b7e3975
commit 8bd515b18d
3 changed files with 13 additions and 10 deletions

View File

@ -1,6 +1,6 @@
function main() { function main() {
var hid = new Hid(); var hid = new Hid();
var ui = new Ui(hid);
new Session(new Atx(), hid, new Msd()); new Session(new Atx(), hid, new Msd());
new Stream(); new Stream(ui);
new Ui(hid);
} }

View File

@ -1,4 +1,4 @@
function Stream() { function Stream(ui) {
// var self = this; // var self = this;
/********************************************************************************/ /********************************************************************************/
@ -69,6 +69,7 @@ function Stream() {
var el_stream_image = $("stream-image"); var el_stream_image = $("stream-image");
el_stream_image.style.width = __normal_size.width * __size_factor + "px"; el_stream_image.style.width = __normal_size.width * __size_factor + "px";
el_stream_image.style.height = __normal_size.height * __size_factor + "px"; el_stream_image.style.height = __normal_size.height * __size_factor + "px";
ui.showWindow($("stream-window"));
}; };
var __refreshImage = function() { var __refreshImage = function() {

View File

@ -1,10 +1,12 @@
function Ui(hid) { function Ui(hid) {
var self = this;
/********************************************************************************/
var __top_z_index = 0; var __top_z_index = 0;
var __windows = []; var __windows = [];
var __ctl_items = []; var __ctl_items = [];
/********************************************************************************/
var __init__ = function() { var __init__ = function() {
Array.prototype.forEach.call($$("ctl-item"), function(el_item) { Array.prototype.forEach.call($$("ctl-item"), function(el_item) {
el_item.onclick = () => __toggleMenu(el_item); el_item.onclick = () => __toggleMenu(el_item);
@ -56,16 +58,16 @@ function Ui(hid) {
window.onmouseup = __globalMouseButtonHandler; window.onmouseup = __globalMouseButtonHandler;
// window.oncontextmenu = __globalMouseButtonHandler; // window.oncontextmenu = __globalMouseButtonHandler;
$("show-about-button").onclick = () => __showWindow($("about-window")); $("show-about-button").onclick = () => self.showWindow($("about-window"));
$("show-keyboard-button").onclick = () => __showWindow($("keyboard-window")); $("show-keyboard-button").onclick = () => self.showWindow($("keyboard-window"));
$("show-stream-button").onclick = () => __showWindow($("stream-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")) { if (!__isWindowOnPage(el_window) || el_window.hasAttribute("data-centered")) {
var view = __getViewGeometry(); var view = __getViewGeometry();
var rect = el_window.getBoundingClientRect(); var rect = el_window.getBoundingClientRect();