| 8374 | and the first real one performs it. */ |
| 8375 | let fitPending=null; |
| 8376 | const reflow=()=>{ |
| 8377 | /* FIRST, and before anything reads a dimension: everything below sizes |
| 8378 | itself off the box, so the box has to be true before any of it runs. */ |
| 8379 | measure(); |
| 8380 | /* Re-read the ratio, don't just re-read the size: dragging the window to a |
| 8381 | second monitor changes devicePixelRatio, and sizePost below picks the new |
| 8382 | one up for its buffers whether the canvas does or not. */ |
| 8383 | renderer.setPixelRatio(dprCap()); |
| 8384 | renderer.setSize(VW,VH); drawSpark(); |
| 8385 | /* Safe despite sizePost's consts being declared further down: module |
| 8386 | evaluation is synchronous, so no resize can fire before they exist. */ |
| 8387 | sizePost(); |
| 8388 | if(fitPending&&VW>0&&VH>0){ const b=fitPending; fitPending=null; frameBounds(b); } |
| 8389 | else placeCam(); |
| 8390 | }; |
| 8391 | /* A drag-resize fires dozens of times a second and every one of those |
| 8392 | reallocates four render targets. The screen paints once a frame regardless, |
| 8393 | so the last size before a paint is the only one that was ever going to be |