summaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2021-04-13 10:49:59 +0300
committerDevaev Maxim <[email protected]>2021-04-13 10:50:10 +0300
commit79202c67b26848f610d90019246d2fc0e90703e9 (patch)
treed0b8d9dd3e6891b3b6947019ae194e20f9e2b4eb /web
parent5dc123e1860be5e582de1ed4341296c3c3f649da (diff)
keep window ratio on reducing
Diffstat (limited to 'web')
-rw-r--r--web/share/js/wm.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/web/share/js/wm.js b/web/share/js/wm.js
index b74e2626..aa6beba8 100644
--- a/web/share/js/wm.js
+++ b/web/share/js/wm.js
@@ -75,7 +75,9 @@ function __WindowManager() {
let view = self.getViewGeometry();
let rect = el_window.getBoundingClientRect();
if ((rect.bottom - rect.top) > (view.bottom - view.top)) {
+ let ratio = (rect.bottom - rect.top) / (view.bottom - view.top);
el_window.style.height = view.bottom - view.top + "px";
+ el_window.style.width = Math.round((rect.right - rect.left) / ratio) + "px";
}
if (el_window.hasAttribute("data-centered")) {
@@ -377,7 +379,9 @@ function __WindowManager() {
if (el_window.classList.contains("window-resizable")) {
// При переполнении рабочей области сократить размер окна
if ((rect.bottom - rect.top) > (view.bottom - view.top)) {
+ let ratio = (rect.bottom - rect.top) / (view.bottom - view.top);
el_window.style.height = view.bottom - view.top + "px";
+ el_window.style.width = Math.round((rect.right - rect.left) / ratio) + "px";
}
if ((rect.right - rect.left) > (view.right - view.left)) {
el_window.style.width = view.right - view.left + "px";