mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 17:20:30 +08:00
keep window ratio on reducing
This commit is contained in:
parent
5dc123e186
commit
79202c67b2
@ -75,7 +75,9 @@ function __WindowManager() {
|
|||||||
let view = self.getViewGeometry();
|
let view = self.getViewGeometry();
|
||||||
let rect = el_window.getBoundingClientRect();
|
let rect = el_window.getBoundingClientRect();
|
||||||
if ((rect.bottom - rect.top) > (view.bottom - view.top)) {
|
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.height = view.bottom - view.top + "px";
|
||||||
|
el_window.style.width = Math.round((rect.right - rect.left) / ratio) + "px";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (el_window.hasAttribute("data-centered")) {
|
if (el_window.hasAttribute("data-centered")) {
|
||||||
@ -377,7 +379,9 @@ function __WindowManager() {
|
|||||||
if (el_window.classList.contains("window-resizable")) {
|
if (el_window.classList.contains("window-resizable")) {
|
||||||
// При переполнении рабочей области сократить размер окна
|
// При переполнении рабочей области сократить размер окна
|
||||||
if ((rect.bottom - rect.top) > (view.bottom - view.top)) {
|
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.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)) {
|
if ((rect.right - rect.left) > (view.right - view.left)) {
|
||||||
el_window.style.width = view.right - view.left + "px";
|
el_window.style.width = view.right - view.left + "px";
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user