feat(screenshot): draw TV overlay refs at the page's capture scale
Summary
Follow-up to #4635. On Tizen and webOS, screenshot --overlay-refs drew CSS px rects 1:1 on the capture. Tizen boxes came out too small and offset (1280 meta viewport, captured at 1.5×). On webOS (1280×720 app), boxes for nodes past the page edge spilled onto the padding.
buildSnapshotState
+ captureScale carried beside viewport
projectRectToScreenshot (overlay)
- rects 1:1, clamped to the image
+ rects × captureScale, clamped to viewport × captureScale # same as --crop-on
8 files, no linked issue. Scope expansion: SnapshotState.captureScale (internal). A tree without a scale keeps 1:1 boxes and is not refused.
Validation
Tested 59f385621 on bfb67d5cc; hardware ran on 851a13449, before a refactor-only amend that keeps Fallow complexity under threshold. The local registry mirror lacks packages for this lockfile, so the local runs used the #4635 worktree with this patch applied. CI validates the head.
- vitest
capture-kit,daemon/src/execution,tv-cdp: 2071/2071. Typecheck, oxlint, oxfmt,fr: clean. - Mutation: reverting the overlay projection fails both new tests.
- Hardware, webOS 22 and Tizen 9.0, static fixture. Each
overlayRectwas compared with the element's frame found from border pixels in a plainscreenshot:- webOS 1920×1080 app: 400×240 at (200,300) and the edge node at 80×100 match.
- webOS 1280×720 app: both match, with 0 overlay pixels outside the page. Before the fix: edge box 300×100, 1072 pixels outside.
- Tizen native: both match. Tizen 1280 meta viewport (
visualViewport.scale1.5): 600×360 at (300,450) and edge 120×150 at (1800,900) match. Before the fix: 400×240 at (200,300) and 300×100 at (1200,600).
Screenshots:
- webOS 1280×720 app, edge box, before / after:
- webOS 1280×720 app, full capture with overlay:
- Tizen 1280 meta viewport, before / after:
Risks: on a scaled Tizen page, JSON center is in screenshot px, not the CSS px that press takes.
Two-way door. Blast radius: TV plugins.
🤖 Generated with Claude Code
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.