MCPcopy Create free account
hub / github.com/dailydotdev/apps / reflow

Function reflow

packages/webapp/components/world/engine/world.js:8619–8633  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8617 and the first real one performs it. */
8618let fitPending=null;
8619const 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

Callers 1

tickFunction · 0.85

Calls 6

dprCapFunction · 0.85
drawSparkFunction · 0.85
sizePostFunction · 0.85
frameBoundsFunction · 0.85
placeCamFunction · 0.85
measureFunction · 0.70

Tested by

no test coverage detected