Click-to-fullscreen now works with Safari as well.

This commit is contained in:
Rezmason
2021-12-19 23:24:15 -08:00
parent bdd8782619
commit 62e9bfea82

View File

@@ -41,10 +41,14 @@ export default async (canvas, config) => {
canvas.height = Math.ceil(canvas.clientHeight * config.resolution); canvas.height = Math.ceil(canvas.clientHeight * config.resolution);
}; };
window.onresize = resize; window.onresize = resize;
if (document.fullscreenEnabled) { if (document.fullscreenEnabled || document.webkitFullscreenEnabled) {
window.onclick = () => { window.onclick = () => {
if (document.fullscreenElement == null) { if (document.fullscreenElement == null) {
document.documentElement.requestFullscreen(); if (canvas.webkitRequestFullscreen != null) {
canvas.webkitRequestFullscreen();
} else {
canvas.requestFullscreen();
}
} else { } else {
document.exitFullscreen(); document.exitFullscreen();
} }