| 8617 | and the first real one performs it. */ |
| 8618 | let fitPending=null; |
| 8619 | const reflow=()=>{ |
| 8620 | /* FIRST, and before anything reads a dimension: everything below sizes |
| 8621 | itself off the box, so the box has to be true before any of it runs. */ |
| 8622 | measure(); |
| 8623 | /* Re-read the ratio, don't just re-read the size: dragging the window to a |
| 8624 | second monitor changes devicePixelRatio, and sizePost below picks the new |
| 8625 | one up for its buffers whether the canvas does or not. */ |
| 8626 | renderer.setPixelRatio(dprCap()); |
| 8627 | renderer.setSize(VW,VH); drawSpark(); |
| 8628 | /* Safe despite sizePost's consts being declared further down: module |
| 8629 | evaluation is synchronous, so no resize can fire before they exist. */ |
| 8630 | sizePost(); |
| 8631 | if(fitPending&&VW>0&&VH>0){ const b=fitPending; fitPending=null; frameBounds(b); } |
| 8632 | else placeCam(); |
| 8633 | }; |
| 8634 | /* A drag-resize fires dozens of times a second and every one of those |
| 8635 | reallocates four render targets. The screen paints once a frame regardless, |
| 8636 | so the last size before a paint is the only one that was ever going to be |