Skip to content

Structure tab: draw the full-page screenshot at wireframe size - #64

Open
woutervanwijk wants to merge 2 commits into
mainfrom
claude/structure-screenshot-fit-canvas
Open

woutervanwijk wants to merge 2 commits into
mainfrom
claude/structure-screenshot-fit-canvas

Conversation

@woutervanwijk

Copy link
Copy Markdown
Owner

The full-page background was drawn at the capture-time CSS page size x wireframe scale, while the canvas is the measured layout x scale. When those heights disagree (on a phone the page grows during scroll-through, and the new screenshot can arrive before the re-measured layout), the image was drawn much larger than the wireframe and clipped — zoomed and misaligned.

Fix: draw the background stretched over the whole canvas, so the screenshot and the blocks always share one coordinate space. The bitmap is also decoded downscaled to the wireframe's max width (it never displays wider). The now-unused fullPageScreenshotCss is removed.

flutter analyze clean, flutter test 1685 pass.

woutervanwijk and others added 2 commits November 20, 2026 12:07
The full-page background was drawn at the capture-time CSS page size
times the wireframe scale, while the canvas is the measured layout
times the scale. When the two heights disagree (on a phone the page
grows during the scroll-through, and the new screenshot can arrive
before the re-measured layout), the image was drawn much larger than
the wireframe and clipped, so it looked zoomed and misaligned.

Draw the background stretched over the whole canvas instead: the
canvas is the page, so the screenshot and the blocks always share one
coordinate space. Also decode the bitmap downscaled to the wireframe's
max width (the wireframe never displays wider), so a full-resolution
capture no longer wastes memory. The now-unused fullPageScreenshotCss
is removed.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
…t swap

The layout script measured only scrollingElement's scroll size while
the full-page capture takes max(scrollingElement, body) — on pages
where <body> is the taller one the wireframe's page size disagreed
with the capture's, so the screenshot and the blocks were drawn in
different coordinate spaces. Take the max of both in the layout
script too.

Also swap the decoded background image and its full-page flag
atomically, and drop a stale shot of the other kind immediately, so
the old viewport shot is never stretched over the full canvas while
the full-page shot decodes.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant