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

Function reflow

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

Source from the content-addressed store, hash-verified

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

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