Repository navigation
fix(annotate): keep the same room between a box and its target at any image size - #230
Conversation
… image size A box drew its line 3px out in 420px reference units, but its SVG's margin was a fixed 5px of CSS, so the two only agreed at 420px wide. On a wider image the gap shrank to nothing and the box sat on the text. The box is now padded out from its area by --ca-pad (6px) in CSS, with its line on the padding's edge and its number on that corner.
Latest result Pull request merged. Final answersSession Pull request merged. Session Pushed d1e4cf5, fixing Pullfrog P1 chart placement and P1 CSS-padding contract mismatches; resolved both threads. Package-scoped vp test passed: annotate 64 passed with one expected failure; charts 40 passed. Focused lint, typechecks, and git diff --check passed after the host-required dependency refresh. Awaiting hosted checks. Session Pushed d1e4cf5, fixing Pullfrog P1 chart placement and P1 CSS-padding contract mismatches; resolved both threads. Package-scoped vp test passed: annotate 64 passed with one expected failure; charts 40 passed. Focused lint, typechecks, and git diff --check passed after the host-required dependency refresh. Awaiting hosted checks. Session Pushed d1e4cf5, fixing Pullfrog P1 chart placement and P1 CSS-padding contract mismatches; resolved both threads. Package-scoped vp test passed: annotate 64 passed with one expected failure; charts 40 passed. Focused lint, typechecks, and git diff --check passed after the host-required dependency refresh. Awaiting hosted checks. Session Pushed d1e4cf5, fixing Pullfrog P1 chart placement and P1 CSS-padding contract mismatches; resolved both threads. Package-scoped vp test passed: annotate 64 passed with one expected failure; charts 40 passed. Focused lint, typechecks, and git diff --check passed after the host-required dependency refresh. Awaiting hosted checks. Session Pushed d1e4cf5, fixing Pullfrog P1 chart placement and P1 CSS-padding contract mismatches; resolved both threads. Package-scoped vp test passed: annotate 64 passed with one expected failure; charts 40 passed. Focused lint, typechecks, and git diff --check passed after the host-required dependency refresh. Awaiting hosted checks. Session Pushed d1e4cf5, fixing Pullfrog P1 chart placement and P1 CSS-padding contract mismatches; resolved both threads. Package-scoped vp test passed: annotate 64 passed with one expected failure; charts 40 passed. Focused lint, typechecks, and git diff --check passed after the host-required dependency refresh. Awaiting hosted checks. Session Pushed d1e4cf5, fixing Pullfrog P1 chart placement and P1 CSS-padding contract mismatches; resolved both threads. Package-scoped vp test passed: annotate 64 passed with one expected failure; charts 40 passed. Focused lint, typechecks, and git diff --check passed after the host-required dependency refresh. Awaiting hosted checks. |
There was a problem hiding this comment.
Important
The new documented padding variable can make stamp placement disagree with the rendered box and should be reconciled before merging.
Reviewed changes in 606417e, covering the box geometry, CSS layout, placement calculations, documentation, and updated CLI expectation.
- Fixed-size box clearance: moves the box offset from scalable SVG coordinates to CSS padding so the stroke stays the same distance from its target at different rendered widths.
- Padded-corner placement: expands box rectangles by the default padding before choosing stamp corners and calculating overlaps.
- Public styling variable: documents
--ca-padwith a6pxdefault for controlling the box clearance. - Updated edge expectation: adjusts the CLI render assertion for a box at the image's top-left corner.
gpt-5.6-sol | 𝕏
🚀 Deploying Preview to Cloudflare 🚀Preview Deployments by commit
|
There was a problem hiding this comment.
Important
The chart-specific padding override makes box rendering and stamp placement use different geometry, which can choose the wrong corner or edge behavior.
Reviewed changes since the prior Pullfrog review in 606417e, covering the chart-specific box-padding adjustment and its interaction with annotate placement.
- Removed chart box padding: set
--ca-padto0for marked charts because chart drawing already grows annotation areas around their shapes. - Kept chart boxes inside the plot: avoided adding CSS-space clearance outside the chart annotation rectangle at plot edges.
gpt-5.6-sol | 𝕏
comark-annotate
comark-badge
comark-cards
comark-carousel
comark-cast
comark-charts
comark-chat
comark-chips
comark-cjk
comark-code
comark-code-notes
comark-colors
comark-critic
comark-deflist
comark-details
comark-diagrams
comark-diff
comark-embed
comark-fields
comark-figure
comark-file-tree
comark-footnotes
comark-github
comark-icon
comark-include
comark-keys
comark-links
comark-linter
comark-mark
comark-mathml
comark-media
comark-metrics
comark-outline
comark-properties
comark-qr
comark-quiz
comark-reading-time
comark-sources
comark-steps
comark-table
comark-tabs
comark-tests
comark-ui
comark-xref
comark-zoom
commit: |
|
Fixed the chart geometry finding by passing zero padding through rendering and placement together: the sankey salary regression now centers its stamp instead of incorrectly shifting it to |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes since the prior Pullfrog review at dec5e23, focusing on the shared box-padding contract and chart-specific geometry.
- Unified padding source: exported
BOX_PADDINGfor both default CSS rendering and server-side stamp placement, while removing the independently overridable--ca-padvariable. - Threaded effective geometry: added
boxPaddingthroughannotateHtml(),figure(), andparts()so rendering andplace()use the same value. - Aligned chart boxes: passed zero padding for chart annotations and emitted matching inline box geometry because chart drawing already includes clearance.
- Covered the edge case: added screenshot and Sankey assertions for fixed clearance and chart stamp placement near the plot edge.
gpt-5.6-sol | 𝕏

A `box` mark drew its line 3px outside its area in 420px reference units, but its SVG's margin was a fixed 5px of CSS. The two only agreed when the image rendered 420px wide. Wider than that, the stretched drawing pulled the line inward, so at a full-width slider (~1080px) the box sat right on the text it marks.
Now the box is padded out from its area by a new `--ca-pad` token (6px) in CSS. Its SVG fills the padded box with a `0 0 w h` viewBox, so the line lands 6px off the target at any size, and the number stays centered on the padded corner. `place()` counts the padding when it looks for free corners.
Checked with `vp test packages/annotate/test/annotate.test.ts` (63 passed) and `vp check`, plus a render of a slider and a column compare at 1100px wide.
🤖 Generated with Claude Code