mirror of
https://github.com/storytold/figcraft.git
synced 2026-10-30 05:16:56 -06:00
The browser renders on the UI thread. A zoom showed its coarse preview and then, in the very next frame, ran the full render, so every wheel step of a continuous zoom had a blocking full render between it and the next: on a heavy page each one took seconds, and the zoom stuttered for as long as it went on. The browser's worker (`Inline`) now refines a preview only once no newer request has come for `SETTLE_MS` (120 ms) after the preview was shown: the zoom has paused. Each wheel step still shows its preview at once, and the worker asks for a repaint when the wait is over. Pans and edits have no preview and are refined at once, as before. The desktop has a render thread of its own and is unchanged. A zoom passing through a scale also no longer spends a full render there. The wait counts from the preview being handed over, not from the request: rendering the preview can itself take longer than the wait (the page is blocked meanwhile, so no newer request could have come), and counted from the request the full render would follow in the very next frame, as before. Measured in Chrome on a synthetic page of 20 images, 60 shadowed rectangles and two background blurs (a full render takes about 3.7 s, a preview about 250 ms), 20 wheel steps in and 20 out, 50 ms apart, three runs each: the frame interval's p95 went from 3.7 s to 240 ms, the frames over 100 ms from 79–80 (one full render per step) to 39–41 (one preview per step), and the zoom took 10–12 s instead of 141 s. The one full render after the pause still takes as long as before. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>