WebGL map: join each line's segments, and draw a link being dragged out under the cities

A see-through line on the card was one round-ended quad per segment, so
where two met it was blended twice: the selected tube's halo showed a
darker blob at every point, and the cables a notch at every corner. Each
segment now knows its neighbours' directions and keeps only its side of
the corner's bisector, as the 2D canvas strokes a path once.

The link being dragged out was painted on the overlay, above the cities
and their labels; it now goes to the card, under them, as in 2D, and its
price label is a picture like the others.

Auto after Always 2D, when the browser will not give the context back,
gives the card up instead of waiting for it all session. Firefox reads
the card's name from RENDERER, without the extension it warns about.
This commit is contained in:
Frederic Jung 2026-11-05 10:31:19 +01:00
parent f9c85ab0c3
commit 7f4fdf6043
No known key found for this signature in database
13 changed files with 201 additions and 39 deletions

View file

@ -106,7 +106,7 @@ const GLSTUB = `window.__GLSTUB=(()=>{const calls=[];const gl=new Proxy({calls},
return (...a)=>{calls.push(k);return {};};}});
const c=document.getElementById('mapgl'),f=document.getElementById('mapfx');const P=()=>({p:{},u:{}}),B=()=>({v:{},b:{}});
const fx=document.createElement('canvas').getContext('2d');
Object.assign(GLX,{want:true,dead:false,gl,c,f,fx,line:P(),pk:P(),fill:P(),fan:P(),ell:P(),land:{},circ:P(),tex:{},lv:B(),hv:B(),pv:B(),cb:B(),wv:B(),cl:B(),empty:{},key:[],gpu:'stub'});
Object.assign(GLX,{want:true,dead:false,gl,c,f,fx,line:P(),pk:P(),fill:P(),fan:P(),ell:P(),land:{},circ:P(),tex:{},lv:B(),hv:B(),pv:B(),cb:B(),wv:B(),dv:B(),cl:B(),empty:{},key:[],gpu:'stub'});
GLS.prog=P();GLS.vao={};GLS.buf={};GLS.tex={};GLS.size=4096;SPRS.clear();GLS.shx=GLS.shy=GLS.shh=0;return gl;})();0`;
function open() {

View file

@ -19,7 +19,7 @@ const STUB = `(()=>{const calls=[];const gl=new Proxy({calls},{get(t,k){if(k in
return (...a)=>{calls.push([k,...a]);return {};};}});
const c=document.getElementById('mapgl'),f=document.getElementById('mapfx');
const P=()=>({p:{},u:{}}),B=()=>({v:{},b:{}});
Object.assign(GLX,{want:true,dead:false,gl,c,f,fx:f.getContext('2d'),line:P(),pk:P(),fill:P(),fan:P(),ell:P(),land:{},circ:P(),tex:{},lv:B(),hv:B(),pv:B(),cb:B(),wv:B(),cl:B(),empty:{},key:[],gpu:'stub'});return gl;})()`;
Object.assign(GLX,{want:true,dead:false,gl,c,f,fx:f.getContext('2d'),line:P(),pk:P(),fill:P(),fan:P(),ell:P(),land:{},circ:P(),tex:{},lv:B(),hv:B(),pv:B(),cb:B(),wv:B(),dv:B(),cl:B(),empty:{},key:[],gpu:'stub'});return gl;})()`;
test('a simplified coastline never strays more than the tolerance from the full one', () => {
const { ev, errors } = open();

View file

@ -161,3 +161,15 @@ test('opening Settings never makes a context, and still says when the card canno
assert.equal(note(), true, 'no WebGL2 in this browser: Settings says so');
assert.deepEqual(errors, []);
});
test('Auto after Always 2D, when the browser will not give the context back, gives the card up instead of waiting all session', () => {
const { ev, errors } = open();
assert.equal(JSON.parse(frame(ev)).gl, true);
ev(`ACT.mapSet({v:'2d'});`);
assert.equal(ev('GLX.sleep&&GLX.lost'), true, 'Always 2D let the context go');
ev(`GLX.lose.restoreContext=()=>{throw new Error('not now');};ACT.mapSet({v:'auto'});`);
const f = JSON.parse(frame(ev));
assert.deepEqual([f.gl, f.dead, f.lost], [false, true, true], 'given up for 2D, with a reason');
assert.match(ev('diagMap()'), /map: 2D \(not now\)/, 'Diagnostic info says why, not "waiting for it back"');
assert.deepEqual(errors, []);
});

View file

@ -19,7 +19,7 @@ const STUB = `(()=>{const calls=[];const gl=new Proxy({calls},{get(t,k){if(k in
return (...a)=>{calls.push([k,...a]);return {};};}});
const c=document.getElementById('mapgl'),f=document.getElementById('mapfx');
const P=()=>({p:{},u:{}}),B=()=>({v:{},b:{}});
Object.assign(GLX,{want:true,dead:false,gl,c,f,fx:f.getContext('2d'),line:P(),pk:P(),fill:P(),fan:P(),ell:P(),land:{},circ:P(),tex:{},lv:B(),hv:B(),pv:B(),cb:B(),wv:B(),cl:B(),empty:{},key:[],gpu:'stub'});
Object.assign(GLX,{want:true,dead:false,gl,c,f,fx:f.getContext('2d'),line:P(),pk:P(),fill:P(),fan:P(),ell:P(),land:{},circ:P(),tex:{},lv:B(),hv:B(),pv:B(),cb:B(),wv:B(),dv:B(),cl:B(),empty:{},key:[],gpu:'stub'});
GLS.prog=P();GLS.vao={};GLS.buf={};GLS.tex={};GLS.size=4096;SPRS.clear();GLS.shx=GLS.shy=GLS.shh=0;return gl;})()`;
// Counts the keys joined during one frame (Array#join with '|', as the picture keys are), but the ships' (a handful).

View file

@ -0,0 +1,115 @@
// Lines on the card are one instance per segment. Where two segments of a line meet, each keeps only its side of the
// corner (glJoin() tells it which way its neighbours run), so a see-through line is blended once there, as the 2D
// canvas strokes a path once: the selected tube's halo, the cables, the waves, the fiber's dots. Also: the link being
// dragged out is drawn on the card, under the cities as in 2D, not on the overlay above them.
const test = require('node:test');
const assert = require('node:assert/strict');
const fs = require('node:fs');
const path = require('node:path');
const { load } = require('./harness');
const SAVE = fs.readFileSync(path.join(__dirname, 'fixtures', 'big-network.json'), 'utf8');
function open() {
const h = load({ seed: 777 });
h.ev(`S=migrate(JSON.parse(${JSON.stringify(SAVE)}));UI.started=true;UI.pitched=true;UI.speed=0;closeModal();S.nextFail=S.day+999;S.nextEvent=S.day+999;compute();`);
return h;
}
const STUB = `(()=>{const calls=[];const gl=new Proxy({calls},{get(t,k){if(k in t)return t[k];if(typeof k==='string'&&/^[A-Z_0-9]+$/.test(k))return k;
return (...a)=>{calls.push([k,...a]);return {};};}});
const c=document.getElementById('mapgl'),f=document.getElementById('mapfx');
const P=()=>({p:{},u:{}}),B=()=>({v:{},b:{}});
Object.assign(GLX,{want:true,dead:false,gl,c,f,fx:f.getContext('2d'),line:P(),pk:P(),fill:P(),fan:P(),ell:P(),land:{},circ:P(),tex:{},lv:B(),hv:B(),pv:B(),cb:B(),wv:B(),dv:B(),cl:B(),empty:{},key:[],gpu:'stub'});
GLS.prog=P();GLS.vao={};GLS.buf={};GLS.tex={};GLS.size=4096;SPRS.clear();GLS.shx=GLS.shy=GLS.shh=0;return gl;})()`;
// For records A of segments: which neighbour directions are wrong. A segment whose start is where the previous one
// ended must point back along it; one that starts a line (or ends one) must say it has no neighbour there.
const CHECK = `const joins=(A,n,lines)=>{const S=LINE_STRIDE,bad=[];let joined=0;
for(let i=0;i<n;i++){const o=i*S,first=lines?lines.has(i):!(i&&A[o]===A[o-S+2]&&A[o+1]===A[o-S+3]),last=lines?lines.has(i+1)||i+1===n:!(i+1<n&&A[o+2]===A[o+S]&&A[o+3]===A[o+S+1]);
const pv=first?[0,0]:[Math.fround(A[o-S+2]-A[o-S]),Math.fround(A[o-S+3]-A[o-S+1])],nx=last?[0,0]:[Math.fround(A[o+S+2]-A[o+S]),Math.fround(A[o+S+3]-A[o+S+1])];
const near=(a,b)=>Math.abs(a-b)<=1e-3*Math.max(1,Math.abs(b));if(!near(A[o+12],pv[0])||!near(A[o+13],pv[1])||!near(A[o+14],nx[0])||!near(A[o+15],nx[1]))bad.push(i);if(!first)joined++;}
return {bad:bad.slice(0,5),joined,n};};`;
test('the tubes and the selected one’s halo are joined segment to segment, and only within a tube', () => {
const { ev, errors } = open();
ev(STUB);
const r = JSON.parse(ev(`(()=>{${CHECK}const ML=mapLinks(S.day),{SEG}=glBuild(ML.LG,ML.GM,ML.looks),starts=new Set();let si=0;
for(const gm of ML.GM){starts.add(si);si+=gm.pts.length-1;}
const gi=ML.GM.findIndex(gm=>gm.pts.length>4),H=glHalo(ML.LG,ML.GM,ML.looks,ML.LG[gi][0].id);
return JSON.stringify({tubes:joins(SEG,si,starts),halo:joins(H,H.length/LINE_STRIDE,new Set([0]))});})()`));
assert.deepEqual(r.tubes.bad, [], 'every tube segment knows its neighbours, and no tube runs into the next');
assert.ok(r.tubes.joined > r.tubes.n / 2, `most segments have a neighbour before them (${r.tubes.joined} of ${r.tubes.n})`);
assert.deepEqual(r.halo.bad, []);
assert.ok(r.halo.joined >= 3, 'the halo is one joined line');
assert.deepEqual(errors, []);
});
test('coastlines close on themselves; cables and waves are joined along each line', () => {
const { ev, errors } = open();
ev(STUB);
// A closed ring: the first segment's neighbour before it is the last one.
const ring = JSON.parse(ev(`(()=>{const A=[];const P=[[0,0],[10,0],[10,10],[0,10],[0,0]];for(let i=0;i+1<P.length;i++)glSeg(A,P[i],P[i+1],0,1,0,0,[0,0,0,1]);
glJoin(A,0,4,true);const S=LINE_STRIDE;return JSON.stringify([A.slice(12,16),A.slice(3*S+12,3*S+16)]);})()`));
assert.deepEqual(ring[0], [0, -10, 0, 10], 'the first side follows the last and leads to the second');
assert.deepEqual(ring[1], [-10, 0, 10, 0], 'the last side leads back to the first');
// The land's coastlines are built that way: no segment of a ring is left without neighbours.
const land = JSON.parse(ev(`(()=>{GLX.land={};const gl=GLX.gl;gl.calls.length=0;glLandGeo(gl,false,0);
const sent=gl.calls.filter(c=>c[0]==='bufferData'&&c[2]&&c[2].length%LINE_STRIDE===0&&c[2].length>LINE_STRIDE*10).map(c=>c[2]);
const A=sent[0];let open=0;for(let i=0;i<A.length/LINE_STRIDE;i++){const o=i*LINE_STRIDE;if(!(A[o+12]||A[o+13])||!(A[o+14]||A[o+15]))open++;}return JSON.stringify({n:A.length/LINE_STRIDE,open});})()`));
assert.ok(land.n > 1000, 'the coastlines went to the card');
assert.equal(land.open, 0, 'every coastline is a closed ring');
const r = JSON.parse(ev(`(()=>{${CHECK}const gl=GLX.gl;GLX.ckey=null;glCables(gl,[0],null,false);
const F=gl.calls.filter(c=>c[0]==='bufferData').pop()[2],cs=new Set();let ci=0;for(const cp of CABLE_PAIRS){cs.add(ci);ci+=cp.pts.length-1;}const cab=joins(F,F.length/LINE_STRIDE,cs);
glWaves(gl,1234,[0]);const starts=new Set();for(let i=0;i<WAVES.length;i++)starts.add(i*8);
return JSON.stringify({cab,wav:joins(GLX.wa,WAVES.length*8,starts)});})()`));
assert.deepEqual(r.cab.bad, [], 'cable segments are joined where one ends and the next begins');
assert.ok(r.cab.joined > 100, `cables have corners (${r.cab.joined})`);
assert.deepEqual(r.wav.bad, [], 'each wave is one line of eight segments');
assert.deepEqual(errors, []);
});
test('the line shader takes the neighbours and splits each corner along its bisector', () => {
const { ev } = open();
const vs = ev('GL_LINE_VS'), fs_ = ev('GL_LINE_FS');
assert.match(vs, /layout\(location=3\) in vec4 aN/);
assert.match(fs_, /vEnd\.x>\.5&&x\*vK\.x\+y\*vK\.y<0\./);
assert.match(fs_, /vEnd\.y>\.5&&\(x-vLen\)\*vK\.z\+y\*vK\.w>0\./);
// The rule itself: at a corner, every point is painted by exactly one of the two segments that meet there.
const r = JSON.parse(ev(`(()=>{const norm=v=>{const l=Math.hypot(v[0],v[1]);return [v[0]/l,v[1]/l];},dot=(a,b)=>a[0]*b[0]+a[1]*b[1];
let both=0,none=0,n=0;
for(const deg of [5,30,60,90,135,170]){const r=deg*Math.PI/180,J=[0,0],tA=[1,0],tB=[Math.cos(r),Math.sin(r)],m=norm([tA[0]+tB[0],tA[1]+tB[1]]);
for(let x=-12;x<=12;x+=0.37)for(let y=-12;y<=12;y+=0.41){const P=[x,y];
// In capsule A (ending at J) or B (starting at J), half-width 6.
const inA=Math.hypot(x>0?x:x<-20?x+20:0,y)<=6,
pb=dot(P,tB),qb=Math.max(0,Math.min(20,pb)),inB=Math.hypot(x-qb*tB[0],y-qb*tB[1])<=6;
if(!inA&&!inB)continue;n++;const ownA=inA&&dot(P,m)<=0,ownB=inB&&dot(P,m)>=0;if(ownA&&ownB&&dot(P,m)!==0)both++;if(!ownA&&!ownB)none++;}}
return JSON.stringify({n,both,none});})()`));
assert.ok(r.n > 1000);
assert.equal(r.both, 0, 'no point is painted twice');
assert.equal(r.none, 0, 'no point of the joined line is left out');
});
test('the link being dragged out goes to the card, under the cities, and its price label is a picture', () => {
const { ev, errors } = open();
ev(`const h=CITY[S.home];cam.x=h.x;cam.y=h.y;cam.z=1.4;`);
ev(STUB);
ev(`(()=>{const fx=GLX.fx;fx.__st=0;fx.stroke=function(){fx.__st++;};})()`);
ev(`UI.drag=null;draw(1000);`);
const base = ev('GLX.fx.__st');
ev(`(()=>{const h=CITY[S.home],[x,y]=toS(h.x,h.y,0);UI.drag={mode:'link',from:S.home,cx:x+120,cy:y+40};UI.snap=null;GLX.gl.calls.length=0;GLX.fx.__st=0;draw(1000);})()`);
assert.equal(ev('GLX.fx.__st'), base, 'nothing more is stroked on the overlay above the cities');
const r = JSON.parse(ev(`(()=>{const c=GLX.gl.calls,i=c.findIndex(x=>x[0]==='bufferData'&&x[2]===GLX.da),
d=c.findIndex((x,j)=>j>i&&x[0]==='drawArraysInstanced'&&x[4]===2),A=GLX.da,S=LINE_STRIDE;
return JSON.stringify({sent:i>=0,drawn:d>i,dash:[A[6],A[S+6]],w:[A[5],A[S+5]],off:[A[4],A[S+4]],z:cam.z,dash7:LDASH[7]});})()`));
assert.ok(r.sent && r.drawn, 'the two dotted lines go to the card in one draw');
assert.deepEqual(r.dash, [7, 7]); assert.deepEqual(r.dash7, [2, 12]);
assert.deepEqual(r.w, [7, 4], 'the dark line under the pink one, as in 2D');
assert.equal(r.off[0], 0); assert.ok(Math.abs(r.off[1] - (-1000 / 30 / r.z)) < 1e-3, 'the pink dots run along the line as in 2D');
// Snapped to a city, the price shows on a pill picture with the cities' pictures, not on the overlay.
const label = ev(`(()=>{const h=S.home,b=CITIES.find(c=>c.id!==h&&!isSub(h,c.id)).id,[x,y]=toS(CITY[b].x,CITY[b].y,0);UI.snap={id:b,sx:x,sy:y};GLX.fx.__st=0;draw(1016);
return [...SPRS.keys()].some(k=>k.startsWith('pill|')&&k.includes(' km'));})()`);
assert.equal(label, true);
assert.equal(ev('GLX.fx.__st'), base);
assert.deepEqual(errors, []);
});

View file

@ -21,7 +21,7 @@ const STUB = `(()=>{const calls=[];const gl=new Proxy({calls},{get(t,k){if(k in
return (...a)=>{calls.push([k,...a]);return {};};}});
const c=document.getElementById('mapgl'),f=document.getElementById('mapfx');
const P=()=>({p:{},u:{}}),B=()=>({v:{},b:{}});
Object.assign(GLX,{want:true,dead:false,gl,c,f,fx:f.getContext('2d'),line:P(),pk:P(),fill:P(),fan:P(),ell:P(),land:{},circ:P(),tex:{},lv:B(),hv:B(),pv:B(),cb:B(),wv:B(),cl:B(),empty:{},key:[],gpu:'stub'});return gl;})()`;
Object.assign(GLX,{want:true,dead:false,gl,c,f,fx:f.getContext('2d'),line:P(),pk:P(),fill:P(),fan:P(),ell:P(),land:{},circ:P(),tex:{},lv:B(),hv:B(),pv:B(),cb:B(),wv:B(),dv:B(),cl:B(),empty:{},key:[],gpu:'stub'});return gl;})()`;
test('without WebGL2 the map stays 2D, and asking for WebGL changes nothing', () => {
const { ev, errors } = open();
@ -41,14 +41,14 @@ test('the instance data says what the 2D map draws: points, colours, dashes, pac
const sel=LG[3][0].id,looks=LG.map(g=>linkLook(g,S.day)),{SEG,PK,PT}=glBuild(LG,GM,looks),H=glHalo(LG,GM,looks,sel);let si=0,ki=0,pi=0,hi=0,bad=[];const deps=[];
for(let gi=0;gi<LG.length;gi++){const gm=GM[gi],L=looks[gi],[r,g,b]=glColor(L.col),hot=LG[gi].some(x=>x.id===sel);
for(let j=0;j<gm.pts.length;j++){if(PT[pi*4]!==Math.fround(gm.pts[j][0])||PT[pi*4+2]!==Math.fround(gm.cum[j]))bad.push('pt '+gi);pi++;}
for(let j=0;j+1<gm.pts.length;j++){const o=si*12;
for(let j=0;j+1<gm.pts.length;j++){const o=si*LINE_STRIDE;
if(SEG[o]!==Math.fround(gm.pts[j][0])||SEG[o+3]!==Math.fround(gm.pts[j+1][1]))bad.push('seg '+gi);
if(SEG[o+6]!==L.dash||SEG[o+5]!==Math.fround(L.w0)||SEG[o+9]!==Math.fround(r)||SEG[o+11]!==Math.fround(b))bad.push('look '+gi);
if((SEG[o+7]&1)===1||((SEG[o+7]&2)===2)!==(L.df&&!L.bld&&!L.dark))bad.push('flags '+gi);
if(hot){const h=hi*12;for(let x=0;x<12;x++)if(H[h+x]!==(x===7?1:SEG[o+x]))bad.push('halo '+gi);hi++;}
if(hot){const h=hi*LINE_STRIDE;for(let x=0;x<LINE_STRIDE;x++)if(x<12?H[h+x]!==(x===7?1:SEG[o+x]):Math.abs(H[h+x]-SEG[o+x])>1e-3*Math.max(1,Math.abs(SEG[o+x])))bad.push('halo '+gi);hi++;}
if(j===0)deps.push(SEG[o+8]);si++;}
const n=!L.cut&&L.load>0.01?clamp(Math.round(2+L.u*10),2,12):0;for(let i=0;i<n;i++){if(PK[ki*8+3]!==n||PK[ki*8+4]!==i)bad.push('pk '+gi);ki++;}}
return JSON.stringify({bad:bad.slice(0,5),si,segs:SEG.length/12,ki,pks:PK.length/8,groups:LG.length,
return JSON.stringify({bad:bad.slice(0,5),si,segs:SEG.length/LINE_STRIDE,ki,pks:PK.length/8,groups:LG.length,
order:deps.every((d,i)=>!i||d<deps[i-1]),inRange:deps.every(d=>d>0&&d<1),sel:hi>0&&hi===GLX.nHalo,moving:looks.filter(L=>!L.cut&&L.load>0.01).length});})()`));
assert.deepEqual(r.bad, []);
assert.equal(r.si, r.segs, 'one instance per segment');
@ -74,7 +74,7 @@ test('with WebGL the lines go to the card, the rest to the overlay, and the map
assert.ok(draws.includes(ev('GLX.nSeg')) && draws.includes(ev('GLX.nPk')), 'every segment and every packet in instanced draws');
// Nothing changed: the next frame reuses the buffers. A cut link changes routing, and the tubes are rebuilt.
// The tubes' own buffers (segments, packets, points) are what must not be sent again on an ordinary frame; the waves and clouds move every frame by design.
const uploads = () => ev(`GLX.gl.calls.filter(c=>c[0]==='bufferData'&&c[2]&&c[2].length===GLX.nSeg*12).length`);
const uploads = () => ev(`GLX.gl.calls.filter(c=>c[0]==='bufferData'&&c[2]&&c[2].length===GLX.nSeg*LINE_STRIDE).length`);
const u0 = uploads(); ev('draw(1016)'); assert.equal(uploads(), u0, 'a frame alone uploads no tube data');
const id = ev(`(()=>{const l=S.links.find(l=>l.kind!=='vxc'&&!linkDown(l));l.cut=S.day+5;compute();draw(1032);return l.id;})()`);
assert.ok(uploads() > u0, 'a cut rebuilds the tubes');
@ -298,10 +298,10 @@ test('selecting a tube sends its halo to the card, not the network again', () =>
sent();const l=S.links.find(l=>l.kind!=='vxc'&&!linkDown(l));UI.sel={type:'link',id:l.id};draw(1016);const on=sent(),halo=GLX.nHalo;
UI.sel=null;draw(1032);const off=sent();
return JSON.stringify({nSeg,on,off,halo,haloDraw:GLX.nHalo});})()`));
const tubes = r.nSeg * 12;
const tubes = r.nSeg * ev('LINE_STRIDE');
assert.ok(r.halo > 0, 'the halo has the selected tube’s segments');
assert.ok(!r.on.b.includes(tubes) && r.on.t === 0, 'selecting sends no tube, packet or point again');
assert.ok(r.on.b.includes(r.halo * 12), 'only the halo goes up');
assert.ok(r.on.b.includes(r.halo * ev('LINE_STRIDE')), 'only the halo goes up');
assert.ok(!r.off.b.includes(tubes) && r.off.t === 0, 'nor does unselecting');
assert.equal(r.haloDraw, 0, 'and the halo is gone');
assert.deepEqual(errors, []);

View file

@ -19,7 +19,7 @@ const STUB = `(()=>{const calls=[];const gl=new Proxy({calls},{get(t,k){if(k in
return (...a)=>{calls.push([k,...a]);return {};};}});
const c=document.getElementById('mapgl'),f=document.getElementById('mapfx');
const P=()=>({p:{},u:{}}),B=()=>({v:{},b:{}});
Object.assign(GLX,{want:true,dead:false,gl,c,f,fx:f.getContext('2d'),line:P(),pk:P(),fill:P(),fan:P(),ell:P(),land:{},circ:P(),tex:{},lv:B(),hv:B(),pv:B(),cb:B(),wv:B(),cl:B(),empty:{},key:[],gpu:'stub'});
Object.assign(GLX,{want:true,dead:false,gl,c,f,fx:f.getContext('2d'),line:P(),pk:P(),fill:P(),fan:P(),ell:P(),land:{},circ:P(),tex:{},lv:B(),hv:B(),pv:B(),cb:B(),wv:B(),dv:B(),cl:B(),empty:{},key:[],gpu:'stub'});
GLS.prog=P();GLS.vao={};GLS.buf={};GLS.tex={};GLS.size=4096;SPRS.clear();GLS.shx=GLS.shy=GLS.shh=0;
// Counts the canvases the page makes from here on.
const ce=document.createElement.bind(document);window.__canvases=0;document.createElement=function(t){if(String(t).toLowerCase()==='canvas')__canvases++;return ce.apply(document,arguments);};

View file

@ -21,7 +21,7 @@ const STUB = `(()=>{const calls=[];const gl=new Proxy({calls},{get(t,k){if(k in
return (...a)=>{calls.push([k,...a]);return {};};}});
const c=document.getElementById('mapgl'),f=document.getElementById('mapfx');
const P=()=>({p:{},u:{}}),B=()=>({v:{},b:{}});
Object.assign(GLX,{want:true,dead:false,gl,c,f,fx:f.getContext('2d'),line:P(),pk:P(),fill:P(),fan:P(),ell:P(),land:{},circ:P(),tex:{},lv:B(),hv:B(),pv:B(),cb:B(),wv:B(),cl:B(),empty:{},key:[],gpu:'stub'});
Object.assign(GLX,{want:true,dead:false,gl,c,f,fx:f.getContext('2d'),line:P(),pk:P(),fill:P(),fan:P(),ell:P(),land:{},circ:P(),tex:{},lv:B(),hv:B(),pv:B(),cb:B(),wv:B(),dv:B(),cl:B(),empty:{},key:[],gpu:'stub'});
GLS.prog=P();GLS.vao={};GLS.buf={};GLS.tex={};GLS.size=4096;SPRS.clear();GLS.shx=GLS.shy=GLS.shh=0;return gl;})()`;
// One POP's city pictures painted during frames from zoom z0 to z1 (the clock moving 16 ms a frame), by scale.