mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-16 13:03:31 +08:00
Selection screenshots were drawing the marker after html2canvas finished by mapping DOM coordinates onto a separate canvas. That leaves room for drift when html2canvas renders at a different output size, the viewport is resized, or the thumbnail is compressed. The marker is now a fixed DOM overlay captured with the page itself, so the chosen element and its marker share the same viewport, layout, crop, and scale path. Constraint: No issue number was provided for this task. Constraint: Preserve the existing selection event payload and preview bridge protocol. Rejected: Keep canvas post-processing with more scale math | it still maintains a second coordinate system beside the rendered page. Rejected: Keep the unused annotate module | it would preserve the stale path that caused this class of drift. Confidence: high Scope-risk: narrow Directive: Do not reintroduce canvas-side selection marker math unless it is proven against resized and scaled viewport captures. Tested: cd desktop && bun run test --run src/preview-agent/screenshot.test.ts src/preview-agent/picker.test.ts src/preview-agent/metadata.test.ts src/preview-agent/protocol.test.ts src/preview-agent/bridge.test.ts src/preview-agent/editBubble.test.ts Tested: cd desktop && bun run lint Tested: cd desktop && bun run build:preview-agent Tested: bun run check:desktop Tested: git diff --check Not-tested: Real Tauri webview visual smoke.