From 85e96c6e2efbbec56e2aa456056ee72aad57ed26 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 27 Nov 2026 16:22:39 +0000 Subject: [PATCH] Midnight Ops: no stretched view after hiding Safari's toolbar; full screen button - The 3D view follows the game area's real size (a ResizeObserver plus delayed re-checks after resize, rotation, full screen and visual-viewport changes), because iPhone Safari reports a resize before the page has its new size. Going full screen now shows more of the scene at full sharpness instead of stretching the old picture. - Pause menu: a Full screen button where the browser allows it; on iPhone, a tip to use Safari's Hide Toolbar instead. Spanish included. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Cw2rM7HP4RvtJycwLW1jZr --- e63334287a3deaa3/ironveil/es.js | 1 + e63334287a3deaa3/ironveil/index.html | 4 ++-- e63334287a3deaa3/ironveil/js/main.js | 6 ++++++ e63334287a3deaa3/ironveil/js/render.js | 9 ++++++++- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/e63334287a3deaa3/ironveil/es.js b/e63334287a3deaa3/ironveil/es.js index 828b107a..3218e923 100644 --- a/e63334287a3deaa3/ironveil/es.js +++ b/e63334287a3deaa3/ironveil/es.js @@ -28,6 +28,7 @@ 'Graphics': 'Gráficos', 'Auto': 'Automático', 'Low': 'Bajos', 'Medium': 'Medios', 'High': 'Altos', 'Look speed': 'Velocidad de la mira', 'Field of view': 'Campo de visión', 'Volume': 'Volumen', 'Invert look up and down': 'Invertir mirar arriba y abajo', 'Blood effects': 'Efectos de sangre', 'Language': 'Idioma', 'A change to Graphics takes effect when the page is opened again.': 'El cambio de Gráficos se aplica al volver a abrir la página.', // ---- campaign + 'Full screen': 'Pantalla completa', 'Exit full screen': 'Salir de pantalla completa', 'For full screen on iPhone: tap the aA button in the address bar, then Hide Toolbar. Turn the phone sideways for the widest view.': 'Para pantalla completa en iPhone: toca el botón aA de la barra de direcciones y luego Ocultar barra de herramientas. Gira el teléfono para ver más.', 'Missions': 'Misiones', 'Ready': 'Lista', 'Play': 'Jugar', 'Locked': 'Bloqueada', 'Coming soon': 'Muy pronto', 'Done': 'Hecha', 'Next mission': 'Siguiente misión', 'Next: {t}': 'Siguiente: {t}', 'Building the map': 'Construyendo el mapa', 'Bridge at Dawn': 'El puente al amanecer', 'Take the river bridge, then hold it through three counter-attacks.': 'Toma el puente del río y aguanta tres contraataques.', 'The Clocktower': 'La torre del reloj', 'Sniper overwatch over an occupied town while a courier crosses the square.': 'Cubre con el fusil de precisión a un mensajero que cruza la plaza de un pueblo ocupado.', diff --git a/e63334287a3deaa3/ironveil/index.html b/e63334287a3deaa3/ironveil/index.html index d1f88dbe..b1a71c1b 100644 --- a/e63334287a3deaa3/ironveil/index.html +++ b/e63334287a3deaa3/ironveil/index.html @@ -248,8 +248,8 @@

Before you play

-

Paused

-
+

Paused

+
diff --git a/e63334287a3deaa3/ironveil/js/main.js b/e63334287a3deaa3/ironveil/js/main.js index d84417f2..d33ecc95 100644 --- a/e63334287a3deaa3/ironveil/js/main.js +++ b/e63334287a3deaa3/ironveil/js/main.js @@ -55,6 +55,12 @@ const S = MO.settings, on = (id, fn) => $(id).addEventListener('click', fn); on('b-accept', () => { try { localStorage.setItem('ironveil:terms', '1'); } catch (e) {} show('title'); }); on('b-deploy', () => deploy(false)); on('b-again', () => deploy(false)); on('b-retry', () => deploy(true)); on('b-restart', () => { MO.audio.pause(false); deploy(false); }); + // full screen where the browser allows a page to do it (Android, iPad, computers); iPhone Safari doesn't, so it gets a tip + const de = document.documentElement, canFull = !!(de.requestFullscreen || de.webkitRequestFullscreen), isFull = () => !!(document.fullscreenElement || document.webkitFullscreenElement); + $('b-full').hidden = !canFull; $('p-tip').hidden = canFull || !MO.touch; + const fullText = () => { $('b-full').textContent = MO.T(isFull() ? 'Exit full screen' : 'Full screen'); }; + on('b-full', () => { try { if (isFull()) (document.exitFullscreen || document.webkitExitFullscreen).call(document); else { const p = (de.requestFullscreen || de.webkitRequestFullscreen).call(de, { navigationUI: 'hide' }); if (p && p.catch) p.catch(() => {}); } } catch (e) {} setTimeout(() => { fullText(); if (!isFull()) $('p-tip').hidden = false; }, 500); }); + document.addEventListener('fullscreenchange', fullText); document.addEventListener('webkitfullscreenchange', fullText); fullText(); on('b-missions', missionList); on('b-mclose', () => show('title')); on('b-next', () => { const n = MO.missions.list.find((d) => d.num === MO.missions.current.num + 1); if (n) go(n.id); }); on('b-resume', () => pause(false)); on('b-quit', toTitle); on('b-dquit', toTitle); on('b-gquit', toTitle); const open = (which) => () => { back = MO.screen; show(which); }; diff --git a/e63334287a3deaa3/ironveil/js/render.js b/e63334287a3deaa3/ironveil/js/render.js index 5160f1aa..e0b5e52e 100644 --- a/e63334287a3deaa3/ironveil/js/render.js +++ b/e63334287a3deaa3/ironveil/js/render.js @@ -71,7 +71,13 @@ gl_FragColor = vec4(t * uFade, 1.0); }`, { tA: { value: null }, tB: { value: null }, uPx: { value: new THREE.Vector2() }, uExp: { value: 1 }, uBloom: { value: 0.09 }, uTime: { value: 0 }, uHurt: { value: 0 }, uLow: { value: 0 }, uFade: { value: 1 }, uFlash: { value: 0 }, uAim: { value: 0 } }); R.exposure = 1; R.hooks = []; R.w = 0; R.h = 0; R.resize(); - window.addEventListener('resize', R.resize); + // iPhone Safari sends 'resize' before the page has its new size (hiding the toolbar, turning the phone), so also + // watch the game area itself, and check again a moment after anything that can change the size + const later = () => { R.resize(); setTimeout(R.resize, 120); setTimeout(R.resize, 400); setTimeout(R.resize, 900); }; + window.addEventListener('resize', later); window.addEventListener('orientationchange', later); + document.addEventListener('fullscreenchange', later); document.addEventListener('webkitfullscreenchange', later); + if (window.visualViewport) window.visualViewport.addEventListener('resize', later); + if (window.ResizeObserver) new ResizeObserver(() => R.resize()).observe(canvas.parentElement); return r; }; @@ -85,6 +91,7 @@ } R.resize = () => { const el = R.renderer.domElement.parentElement, w = el.clientWidth || innerWidth, h = el.clientHeight || innerHeight; + if (w === R.vw && h === R.vh && R.dpr === devicePixelRatio) return; R.dpr = devicePixelRatio; R.renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, MO.touch ? 1.5 : 1.25) * R.Q.scale); R.renderer.setSize(w, h, false); R.camera.aspect = R.wcam.aspect = w / h; R.camera.updateProjectionMatrix(); R.wcam.updateProjectionMatrix();