diff options
author | Devaev Maxim <[email protected]> | 2021-04-16 12:00:34 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2021-04-16 12:00:34 +0300 |
commit | cfce96d66b50b3eb2fa707896b952d5006beace9 (patch) | |
tree | 41b40db73e963ff3ad48bb0f5ab91fcd8c82ad74 | |
parent | e40d179032aa9a73681c40121d7ba3c6dfaf5dc0 (diff) |
fixed full screen mode in safari
-rw-r--r-- | web/share/css/window.css | 22 | ||||
-rw-r--r-- | web/share/js/wm.js | 23 |
2 files changed, 33 insertions, 12 deletions
diff --git a/web/share/css/window.css b/web/share/css/window.css index e50db8ba..196adfa1 100644 --- a/web/share/css/window.css +++ b/web/share/css/window.css @@ -52,12 +52,22 @@ div.window-resizable.window-active::-webkit-resizer { width: 20px !important; height: 20px !important; } -div.window-full-screen { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; +div.window:fullscreen { + resize: none !important; + position: absolute !important; + top: 0px !important; + left: 0px !important; + width: 100% !important; + height: 100% !important; +} +div.window:-webkit-full-screen { + resize: none !important; + position: absolute !important; + top: 0px !important; + left: 0px !important; + width: 100% !important; + height: 100% !important; + padding: 0px !important; } div.window div.window-header { diff --git a/web/share/js/wm.js b/web/share/js/wm.js index aa6beba8..4296800c 100644 --- a/web/share/js/wm.js +++ b/web/share/js/wm.js @@ -115,7 +115,7 @@ function __WindowManager() { } let el_full_screen_button = el_window.querySelector(".window-header .window-button-full-screen"); - if (el_full_screen_button) { + if (el_full_screen_button && __getFullScreenFunction(el_window)) { tools.setOnClick(el_full_screen_button, function() { __fullScreenWindow(el_window); __activateLastWindow(el_window); @@ -544,7 +544,9 @@ function __WindowManager() { var __onFullScreenChange = function(event) { let el_window = event.target; - if (!document.fullscreenElement) { + if (document.fullscreenElement) { + el_window.style.padding = "0px 0px 0px 0px"; + } else { el_window.style.padding = ""; let rect = el_window.before_full_screen; if (rect) { @@ -553,15 +555,13 @@ function __WindowManager() { el_window.style.top = rect.top + "px"; el_window.style.left = rect.left + "px"; } - } else { - el_window.style.padding = "0px 0px 0px 0px"; } }; var __fullScreenWindow = function(el_window) { el_window.before_full_screen = el_window.getBoundingClientRect(); - el_window.requestFullscreen(); - if ("keyboard" in navigator && "lock" in navigator.keyboard) { + __getFullScreenFunction(el_window).call(el_window); + if (navigator.keyboard && navigator.keyboard.lock) { navigator.keyboard.lock(); } else { let el_lock_alert = el_window.querySelector(".window-lock-alert"); @@ -582,5 +582,16 @@ function __WindowManager() { el_window.style.height = window.innerHeight - vertical_offset + "px"; }; + var __getFullScreenFunction = function(el_window) { + if (el_window.requestFullscreen) { + return el_window.requestFullscreen; + } else if (el_window.webkitRequestFullscreen) { + return el_window.webkitRequestFullscreen; + } else if (el_window.mozRequestFullscreen) { + return el_window.mozRequestFullscreen; + } + return null; + }; + __init__(); } |