fixed full screen mode in safari

This commit is contained in:
Devaev Maxim 2021-04-16 12:00:34 +03:00
parent e40d179032
commit cfce96d66b
2 changed files with 33 additions and 12 deletions

View File

@ -52,12 +52,22 @@ div.window-resizable.window-active::-webkit-resizer {
width: 20px !important; width: 20px !important;
height: 20px !important; height: 20px !important;
} }
div.window-full-screen { div.window:fullscreen {
position: absolute; resize: none !important;
top: 0; position: absolute !important;
left: 0; top: 0px !important;
width: 100%; left: 0px !important;
height: 100%; 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 { div.window div.window-header {

View File

@ -115,7 +115,7 @@ function __WindowManager() {
} }
let el_full_screen_button = el_window.querySelector(".window-header .window-button-full-screen"); 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() { tools.setOnClick(el_full_screen_button, function() {
__fullScreenWindow(el_window); __fullScreenWindow(el_window);
__activateLastWindow(el_window); __activateLastWindow(el_window);
@ -544,7 +544,9 @@ function __WindowManager() {
var __onFullScreenChange = function(event) { var __onFullScreenChange = function(event) {
let el_window = event.target; let el_window = event.target;
if (!document.fullscreenElement) { if (document.fullscreenElement) {
el_window.style.padding = "0px 0px 0px 0px";
} else {
el_window.style.padding = ""; el_window.style.padding = "";
let rect = el_window.before_full_screen; let rect = el_window.before_full_screen;
if (rect) { if (rect) {
@ -553,15 +555,13 @@ function __WindowManager() {
el_window.style.top = rect.top + "px"; el_window.style.top = rect.top + "px";
el_window.style.left = rect.left + "px"; el_window.style.left = rect.left + "px";
} }
} else {
el_window.style.padding = "0px 0px 0px 0px";
} }
}; };
var __fullScreenWindow = function(el_window) { var __fullScreenWindow = function(el_window) {
el_window.before_full_screen = el_window.getBoundingClientRect(); el_window.before_full_screen = el_window.getBoundingClientRect();
el_window.requestFullscreen(); __getFullScreenFunction(el_window).call(el_window);
if ("keyboard" in navigator && "lock" in navigator.keyboard) { if (navigator.keyboard && navigator.keyboard.lock) {
navigator.keyboard.lock(); navigator.keyboard.lock();
} else { } else {
let el_lock_alert = el_window.querySelector(".window-lock-alert"); 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"; 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__(); __init__();
} }