From a46c9f9694a9177eaa9ca8fc1204fe691846301e Mon Sep 17 00:00:00 2001 From: Frederic Jung Date: Sun, 25 Oct 2026 08:47:50 +0100 Subject: [PATCH] Fill the screen as an iPhone home-screen app (1.18.3) --- CHANGELOG.md | 5 +++++ package-lock.json | 4 ++-- package.json | 2 +- site/index.html | 16 +++++++++++++++- tests/modes.test.js | 27 +++++++++++++++++++++++++++ 5 files changed, 50 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 86826e4..95c4861 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ All notable changes to this project are documented here. The project follows ## [Unreleased] +## [1.18.3] — 2026-10-25 + +- Installed on an iPhone home screen, the game now fills the whole screen. Before, + the tab bar floated above an empty strip at the bottom. + ## [1.18.2] — 2026-10-25 - A new legendary badge, A Petabit a Second, for serving a full petabit per diff --git a/package-lock.json b/package-lock.json index ea84fb5..dcacdf9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "seriesoftubes", - "version": "1.18.2", + "version": "1.18.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "seriesoftubes", - "version": "1.18.2", + "version": "1.18.3", "devDependencies": { "jsdom": "24.1.3" }, diff --git a/package.json b/package.json index 131b944..127ae9f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "seriesoftubes", - "version": "1.18.2", + "version": "1.18.3", "description": "A cartoon browser game about building the internet.", "private": true, "license": "MIT", diff --git a/site/index.html b/site/index.html index ddcaff8..60c1eab 100644 --- a/site/index.html +++ b/site/index.html @@ -373,6 +373,10 @@ input.t{width:100%;box-sizing:border-box;border:3px solid var(--ink);border-radi A decluttered, app-like layout: a one-row status strip at the top, a tab bar at the bottom (play, speed, goals, deals, NOC, networks), and bottom sheets you drag up, down or away. */ html,body{overscroll-behavior:none} +/* iPhone home-screen app with a viewport shorter than the screen: the page box takes the real screen height + and becomes the containing block for everything fixed, so bottom-anchored UI reaches the bottom. */ +html.iosfix,html.iosfix body{height:var(--app-h)} +html.iosfix body{position:fixed;top:0;left:0;right:0;transform:translateZ(0)} button,.chip,.b,a{touch-action:manipulation;-webkit-tap-highlight-color:transparent} #hud,#tabbar,.tabs,.grab{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none} #tabbar,.grab{display:none} @@ -3207,8 +3211,18 @@ function openVxcModal({from,to,prov}){ const cv=$('map'),ctx=cv.getContext('2d'); const cam={x:1050,y:330,z:0.8}; let CW=0,CH=0,DPR=1; -function resize(){DPR=Math.min(2,window.devicePixelRatio||1);CW=innerWidth;CH=innerHeight;cv.width=CW*DPR;cv.height=CH*DPR;} +/* Installed on an iPhone home screen with a translucent status bar, iOS can report a viewport one status bar + shorter than the screen while drawing from the very top, leaving an empty strip under the tab bar. + Measure the screen instead; only on iPhone, standalone, and only when the gap is about a status bar. */ +function fixStandaloneHeight(){const R0=document.documentElement; + const sa=window.navigator.standalone===true||!!(window.matchMedia&&matchMedia('(display-mode: standalone)').matches); + const sh=screen&&screen.width&&screen.height?(innerWidth>innerHeight?Math.min(screen.width,screen.height):Math.max(screen.width,screen.height)):0,gap=sh-innerHeight; + const on=sa&&/iPhone|iPod/.test(navigator.userAgent)&&gap>1&&gap<=80; + R0.classList.toggle('iosfix',on);if(on)R0.style.setProperty('--app-h',sh+'px');else R0.style.removeProperty('--app-h');return on?sh:0;} +function resize(){const ah=fixStandaloneHeight();DPR=Math.min(2,window.devicePixelRatio||1);CW=innerWidth;CH=ah||innerHeight;cv.width=CW*DPR;cv.height=CH*DPR;} addEventListener('resize',()=>{resize();WL.key=null;renderLeft();fitHud();});resize(); +// iOS settles the standalone viewport a moment after launch and after rotating. +for(const t of [300,1000])setTimeout(()=>{resize();WL.key=null;},t);addEventListener('pageshow',()=>{resize();WL.key=null;}); function rng(seed){return()=>{seed|=0;seed=seed+0x6D2B79F5|0;let t=Math.imul(seed^seed>>>15,1|seed);t=t+Math.imul(t^t>>>7,61|t)^t;return((t^t>>>14)>>>0)/4294967296;};} function inPoly(x,y,pts){let ins=false;for(let i=0,j=pts.length-1;iy)!==(yj>y))&&(x<(xj-xi)*(y-yi)/(yj-yi)+xi))ins=!ins;}return ins;} function smoothPath(pts){const p=new Path2D();const n=pts.length;const mid=(a,b)=>[(a[0]+b[0])/2,(a[1]+b[1])/2];let m=mid(pts[n-1],pts[0]);p.moveTo(m[0],m[1]);for(let i=0;i { + const { ev, dom, errors } = load(); + const w = dom.window; + const set = (o, k, v) => Object.defineProperty(o, k, { value: v, configurable: true }); + set(w.navigator, 'userAgent', 'Mozilla/5.0 (iPhone; CPU iPhone OS 18_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148'); + set(w.navigator, 'standalone', true); + set(w, 'screen', { width: 390, height: 844 }); + set(w, 'innerWidth', 390); set(w, 'innerHeight', 797); // one status bar short + ev('resize()'); + assert.equal(ev("document.documentElement.classList.contains('iosfix')"), true); + assert.equal(ev("document.documentElement.style.getPropertyValue('--app-h')"), '844px'); + assert.equal(ev('CH'), 844, 'the map is drawn to the real bottom'); + // landscape: the short side of the screen + set(w, 'innerWidth', 844); set(w, 'innerHeight', 370); + ev('resize()'); + assert.equal(ev('CH'), 390); + // a correct viewport, or Safari in a tab, leaves the page alone + set(w, 'innerWidth', 390); set(w, 'innerHeight', 844); + ev('resize()'); + assert.equal(ev("document.documentElement.classList.contains('iosfix')"), false); + set(w.navigator, 'standalone', false); set(w, 'innerHeight', 700); + ev('resize()'); + assert.equal(ev("document.documentElement.classList.contains('iosfix')"), false); + assert.equal(ev('CH'), 700); + assert.deepEqual(errors, []); +});