MikaFil commited on
Commit
a969b58
Β·
verified Β·
1 Parent(s): 175664b

Update fullscreen_playcanvas.js

Browse files
Files changed (1) hide show
  1. fullscreen_playcanvas.js +24 -17
fullscreen_playcanvas.js CHANGED
@@ -62,9 +62,12 @@
62
  top: 0 !important;
63
  left: 0 !important;
64
  width: 100vw !important;
65
- height: 100vh !important;
 
 
 
66
  max-width: 100vw !important;
67
- max-height: 100vh !important;
68
  padding-bottom: 0 !important;
69
  margin: 0 !important;
70
  z-index: 99999;
@@ -298,19 +301,23 @@
298
  });
299
 
300
  // ─── 16. Resize / orientation ────────────────────────────────────────────────
301
- window.addEventListener('resize', function () {
302
- if (isFullscreen) {
303
- wrapper.style.width = '100vw';
304
- wrapper.style.height = '100vh';
305
- }
306
- });
307
-
308
- window.addEventListener('orientationchange', function () {
309
- if (isFullscreen) {
310
- setTimeout(function () {
311
  wrapper.style.width = '100vw';
312
- wrapper.style.height = '100vh';
313
- }, 200);
314
- }
315
- });
316
- })();
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  top: 0 !important;
63
  left: 0 !important;
64
  width: 100vw !important;
65
+ /* Fallback pour vieux navigateurs */
66
+ height: 100vh !important;
67
+ /* iOS 16+ et navigateurs modernes : s'adapte aux barres dynamiques */
68
+ height: 100dvh !important;
69
  max-width: 100vw !important;
70
+ max-height: 100dvh !important;
71
  padding-bottom: 0 !important;
72
  margin: 0 !important;
73
  z-index: 99999;
 
301
  });
302
 
303
  // ─── 16. Resize / orientation ────────────────────────────────────────────────
304
+ window.addEventListener('resize', function () {
305
+ if (isFullscreen) {
 
 
 
 
 
 
 
 
306
  wrapper.style.width = '100vw';
307
+ // Utilise dvh si disponible, sinon vh
308
+ const heightUnit = (isIOS && CSS.supports('height', '1dvh')) ? '100dvh' : '100vh';
309
+ wrapper.style.height = heightUnit;
310
+ wrapper.style.maxHeight = heightUnit;
311
+ }
312
+ });
313
+
314
+ window.addEventListener('orientationchange', function () {
315
+ if (isFullscreen) {
316
+ setTimeout(function () {
317
+ wrapper.style.width = '100vw';
318
+ const heightUnit = (isIOS && CSS.supports('height', '1dvh')) ? '100dvh' : '100vh';
319
+ wrapper.style.height = heightUnit;
320
+ wrapper.style.maxHeight = heightUnit;
321
+ }, 200);
322
+ }
323
+ });