Repository navigation
feat(annotate): copy a screenshot with its marks, and list side notes under compared screenshots - #26
Conversation
A left or right side note in a two-column compare sat in a gutter between the two screenshots, shrank its own image (379px against 529px for a pair without one), and its arrow could run across the whole image to a far mark. Those notes now join the numbered list under their screenshot, as a slider's already do; notes above stay.
The marks are HTML and SVG over a plain image, so the browser's Copy Image left them out. A Copy button on each screenshot, and Ctrl or Cmd+C on a focused or zoomed one, paints the figure as it rests on the page onto a canvas and writes a PNG to the clipboard. The same PNG sits invisibly over the image and takes the pointer only for a right-click, so the browser's own menu copies it too. Images from another origin are retried with CORS, and a frame without clipboard-write gets a message pointing at the right-click.
Latest result Pull request merged. Final answersSession Pull request merged. Verified HEAD and CI evidence. Base checks pass, while this HEAD has the Doctor and clipboard e2e failures. Classified Pullfrog SVG compositing as P1 and context-menu cleanup race as P1; both remain actionable and were reported on the PR. The push lock prevents repair in this pass. Session Repaired the e2e context-menu race and replaced scalar SVG stroke compensation with SVG rasterization preserving non-scaling stroke semantics. Pushed commit 722eaf7 and resolved the valid Pullfrog P1 thread. Formatting passes; local typecheck remains blocked by unavailable workspace package outputs. Await hosted checks on the new head. Session Repaired the e2e context-menu race and replaced scalar SVG stroke compensation with SVG rasterization preserving non-scaling stroke semantics. Pushed commit 722eaf7 and resolved the valid Pullfrog P1 thread. Formatting passes; local typecheck remains blocked by unavailable workspace package outputs. Await hosted checks on the new head. Session Repaired the e2e context-menu race and replaced scalar SVG stroke compensation with SVG rasterization preserving non-scaling stroke semantics. Pushed commit 722eaf7 and resolved the valid Pullfrog P1 thread. Formatting passes; local typecheck remains blocked by unavailable workspace package outputs. Await hosted checks on the new head. Session Repaired the e2e context-menu race and replaced scalar SVG stroke compensation with SVG rasterization preserving non-scaling stroke semantics. Pushed commit 722eaf7 and resolved the valid Pullfrog P1 thread. Formatting passes; local typecheck remains blocked by unavailable workspace package outputs. Await hosted checks on the new head. Session Repaired the e2e context-menu race and replaced scalar SVG stroke compensation with SVG rasterization preserving non-scaling stroke semantics. Pushed commit 722eaf7 and resolved the valid Pullfrog P1 thread. Formatting passes; local typecheck remains blocked by unavailable workspace package outputs. Await hosted checks on the new head. Session Repaired the e2e context-menu race and replaced scalar SVG stroke compensation with SVG rasterization preserving non-scaling stroke semantics. Pushed commit 722eaf7 and resolved the valid Pullfrog P1 thread. Formatting passes; local typecheck remains blocked by unavailable workspace package outputs. Await hosted checks on the new head. Session Repaired the e2e context-menu race and replaced scalar SVG stroke compensation with SVG rasterization preserving non-scaling stroke semantics. Pushed commit 722eaf7 and resolved the valid Pullfrog P1 thread. Formatting passes; local typecheck remains blocked by unavailable workspace package outputs. Await hosted checks on the new head. Session Repaired the e2e context-menu race and replaced scalar SVG stroke compensation with SVG rasterization preserving non-scaling stroke semantics. Pushed commit 722eaf7 and resolved the valid Pullfrog P1 thread. Formatting passes; local typecheck remains blocked by unavailable workspace package outputs. Await hosted checks on the new head. |
commit: |
🚀 Deploying Preview to Cloudflare 🚀Preview Deployments by commit
|
There was a problem hiding this comment.
Important
The new copy path has concrete browser-compatibility failures that can make the advertised Copy control fail or omit all note text; please address these before merging.
Reviewed changes
- Compare note placement — Reviewed the parser, renderer, and documentation changes that move left/right notes under screenshots while preserving top notes and numbering.
- Canvas copy runtime — Reviewed the new canvas compositor, CORS retry, context-menu overlay, clipboard controls, and cleanup lifecycle.
- Zoom integration and coverage — Reviewed the zoom event integration, generated markup/styles, parse/render tests, and Chromium interaction coverage.
gpt-5.6-sol | 𝕏
|
Fixed both Pullfrog findings in a9f6fba: rounded paths now use primitive Canvas commands, SVG paths no longer require Path2D.addPath(), and text baselines fall back through actual bounding metrics to a font-size estimate when newer metrics are unavailable. |
There was a problem hiding this comment.
Important
The compatibility fix now renders SVG marks through a transformed canvas context, which scales their stroke widths and breaks the advertised non-scaling mark appearance when the screenshot is resized.
Reviewed changes
- Added canvas compatibility fallbacks — Reviewed the new rounded-rectangle path fallback, text-metric fallbacks, and transformed SVG path rendering added since the prior Pullfrog review.
- Retired prior compatibility findings — Confirmed the missing text metrics and
roundRect()/Path2D.addPath()issues are addressed by the latest commit.
gpt-5.6-sol | 𝕏
|
Fixed Pullfrog P1: non-scaling SVG strokes now compensate for the canvas transform so copied marks retain their rendered width. Formatting passes locally; workspace typecheck/build remain blocked by unresolved package outputs and the host Corepack cache, while hosted checks rerun on the pushed head. |
There was a problem hiding this comment.
Important
The latest compatibility fix still produces incorrect stroke widths for copied SVG arrows when their preserveAspectRatio="none" viewBox is resized non-uniformly.
Reviewed changes
- Added non-scaling stroke compensation — Reviewed the new fallback that divides SVG stroke widths by the largest transform axis, alongside the existing transformed
Path2Drendering. - Retired prior compatibility feedback — Confirmed the earlier
roundRect()/Path2D.addPath()and text-metric concerns remain addressed bya9f6fba.
gpt-5.6-sol | 𝕏
There was a problem hiding this comment.
Important
The latest stroke-width compensation still produces visibly incorrect copied arrows when their SVG viewBox is resized non-uniformly.
Reviewed changes
- Changed non-scaling stroke compensation — Reviewed the switch from maximum-axis compensation to geometric-mean compensation for copied SVG marks.
- Added synthetic context-menu coverage — Reviewed the queued overlay
contextmenudispatch and its interaction with the existing context-menu lifecycle; the native browser menu remains unverified, as documented by the PR.
gpt-5.6-sol | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Moved zoom ownership to the stage — Reassigned the zoom item and its context/aside metadata from each screenshot figure to its stage so the zoomed copy can retain the figure's notes, without changing the slider contract.
- Updated documentation wording — Clarified that side-by-side compare notes on the left and right are listed below their screenshot while top notes remain above.
gpt-5.6-sol | 𝕏
There was a problem hiding this comment.
Important
The latest compatibility changes still leave two correctness risks in the new copy path: serialized SVG strokes are stretched after rasterization, and the synchronous synthetic context-menu event can disarm the overlay before the native menu uses it.
Reviewed changes
- Reworked SVG mark rasterization — Reviewed the replacement of transformed
Path2Dpainting with temporary serialized SVG images and the preservation of SVG style attributes. - Changed context-menu dispatch timing — Reviewed the synchronous synthetic
contextmenudispatch and its interaction with overlay cleanup and the native browser menu path.
gpt-5.6-sol | 𝕏
| const source = new Image(); | ||
| source.src = `data:image/svg+xml;charset=utf-8,${encodeURIComponent( | ||
| `<svg xmlns="http://www.w3.org/2000/svg" viewBox="${view.x} ${view.y} ${view.width} ${view.height}" preserveAspectRatio="${node.getAttribute("preserveAspectRatio") || "xMidYMid meet"}">${paths.join("")}</svg>`, | ||
| )}`; | ||
| await source.decode(); | ||
| paint.push((context) => { | ||
| context.globalAlpha = alpha; | ||
| context.drawImage(source, x, y, width, height); |
There was a problem hiding this comment.
The temporary SVG honors vector-effect="non-scaling-stroke" while producing source, but drawImage(source, x, y, width, height) then stretches the already-rasterized bitmap to the destination box. For the generated preserveAspectRatio="none" arrows, non-uniform resizing therefore scales the stroke pixels and the copied PNG still disagrees with the on-page arrow.
| if (armed.hasAttribute("data-menu")) | ||
| armed.dispatchEvent(new MouseEvent("contextmenu", { bubbles: true, button: 2 })); |
There was a problem hiding this comment.
This synchronous synthetic event bubbles to the document listener at line 558, which schedules disarm with a zero-delay timer. A native browser contextmenu event can arrive afterward, after data-menu has been removed, so the browser's Copy Image command can target the underlying bare image instead of the marked overlay; keep the test-only notification from sharing the native cleanup path or otherwise retain the overlay until the native menu interaction is complete.
There was a problem hiding this comment.
Important
The SVG rasterization fix still distorts copied marks whenever the SVG's aspect ratio differs from its rendered annotation box, so the copied PNG can disagree with the screenshot shown on the page.
Reviewed changes
- Replaced transformed path painting — Replaced the canvas
Path2Dtransform and scalar stroke compensation with temporary SVG images carrying computed path styles, then drew those images into the copy canvas. - Made context-menu dispatch synchronous — Changed the synthetic overlay
contextmenudispatch from a microtask to immediate dispatch for deterministic headless behavior.
gpt-5.6-sol | 𝕏
| await source.decode(); | ||
| paint.push((context) => { | ||
| context.globalAlpha = alpha; | ||
| context.drawImage(source, x, y, width, height); |
There was a problem hiding this comment.
drawImage(source, x, y, width, height) stretches the already-rasterized SVG to the annotation box, overriding the SVG's own preserveAspectRatio behavior. For the default xMidYMid meet marks such as checks and crosses, a non-square box distorts the path; for preserveAspectRatio="none" arrows, the post-rasterization resize also scales the rendered non-scaling-stroke unevenly. Preserve the SVG's aspect-ratio and stroke semantics when compositing it into the canvas.
There was a problem hiding this comment.
ℹ️ No additional issues found in this delta; the prior blocking SVG compositing feedback remains open.
Reviewed changes
- Adjusted annotation stroke styling — Reviewed the merged style update that derives mark stroke color from the shared capture-aware token and reduces the base stroke width while preserving the hover state.
gpt-5.6-sol | 𝕏
|
Verified current-head CI failures: required check / check fails only at Doctor with one warning (0 blockers/errors), and e2e fails the Copy test because |
…ts that #14 dropped (#490) #14 (142b3d0) merged a stale branch over e2e/zoom.e2e.ts and deleted five tests and the lastFrame helper that 26233e9 had. They are back against today's fixtures. The closing test and lastFrame live in e2e/motion-zoom.e2e.ts, since the closing travel has come from comark-motion since #474 and the zoom-only renderer closes at once. The screenshot's zoom item is now .ca-stage, and the tab order steps over each screenshot's Copy button, which #26 added.

Two problems from the Drop doc comark-github-callouts: before and after.
Copying a screenshot drops its marks
The marks, stamps, arrows, and notes are HTML and SVG over a plain
<img>, so the browser's Copy Image copied only the bare bitmap.What changed
::screenshot, including each one in a two-column compare, gets a small Copy button on the image's top-right corner. It shows on hover and focus, always on touch screens and in the zoomed view, and stays hidden until the script starts and the browser hasnavigator.clipboard.writeandClipboardItem. Without a script the output reads as before. Sliders get no button.Path2Ds from their ownviewBoxes, with the computed stroke widths and colors. Text is placed word by word at the positions the browser laid out, in the computed font, so Caveat notes, inline code, and wrapping all match. Stamps get their fill and their ring. The resolution is the larger of the screen's and the image file's, capped at 3×. While it reads styles it turns off the hover highlight and transitions, so a hovered mark doesn't come out thicker.<img class="ca-overlay">over the image. That overlay haspointer-events: none, except for the moment of a right-click (or a Control-click on a Mac), when it takes the pointer. The menu's Copy Image then copies the PNG with its marks. Clicks, hover links, and zoom still reach the marks; the e2e checks that a right-click lands on the overlay and that the next click still zooms.comarklayer and use the--_comark-*tokens (background, border, accent, ring, radius, font).Limits
<img>keeps nocrossoriginattribute, because that would stop images from loading on hosts that don't send CORS headers. If the canvas is tainted, the copy reloads the image withcrossOrigin = "anonymous". If that fails as well, the button says "The image's server doesn't allow copying it (no CORS)", and the context menu falls back to the bare image. Drop doesn't hit this case today: it inlines a doc's images asdata:URLs, and those don't taint the canvas. Its/f/<id>.pngURLs send noAccess-Control-Allow-Originheader, though (I checked GET and OPTIONS with anOriginheader), so a host that links them directly would hit this fallback.<iframe sandbox="allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox" srcdoc>with noallowattribute, soclipboard-writeis blocked by permissions policy. In that case the button says "This page can't write to the clipboard. Right-click the image and copy it instead", and the right-click does give the copy with marks. For the button and the shortcut to work in Drop, its frame needsallow="clipboard-write". I tested this with a copy of Drop's frame setup: withoutallowthe write is refused, and with it the PNG lands on the clipboard. Writing to the clipboard also needs a secure context and a user gesture. TheClipboardItemis created inside the click or keypress, with a promise for the blob, which is what Safari requires.Annotations overflow in a compare
At 1440px with Drop's comments panel closed, Drop widens a compare to 1080px, so each screenshot is 529px wide. The 28rem breakpoint keeps side notes beside the image at that width. That caused three problems:
side="right"drew an arrow across about 85% of the image. It ran through the screenshot's own text ("Keep the existing endpoint…").Fix: in a two-column compare, left and right side notes join the numbered list under their screenshot. Sliders already handle side notes this way, since an arrow there would cross the divider. Notes with
side="top"stay above, because each one stays in its own column and theca-toppadding already keeps a pair level. This is done inread.ts, so the overlap check no longer reports listed notes that are close together. The docs, README, and skill are updated.Long arrows on a single screenshot are by design: a side note sits in the gutter at its mark's height. I left them alone.
Verification
pnpm readypasses: format, build with publint, lint, typecheck, 74 tests, and Vite Doctor with 0 warnings. fix: green CI on main after #14 and #17 #24 is merged, so main is green and nothing here depends on it.E2E_PORT=4331 pnpm test:e2e: 31 passed. The new e2e grants clipboard permissions and clicks Copy. It reads the PNG back and checks that the first stamp's color appears where the stamp sits. It also checks that a right-click on the image lands on the overlay, that a click still zooms, and that Ctrl/⌘+C in the zoomed view copies.srcdocframe, with and withoutallow="clipboard-write"Not verified: a real (headed) browser context menu's Copy Image. Headless Chromium has no native menu, so the e2e checks the
contextmenutarget, which is what the menu uses. Firefox and Safari are also untested.🤖 Generated with Claude Code