Skip to content

fix(annotate): keep the same room between a box and its target at any image size - #230

Merged
vite-hub[bot] merged 3 commits into
mainfrom
fix/annotate-box-padding
Oct 27, 2026
Merged

vite-hub[bot] merged 3 commits into
mainfrom
fix/annotate-box-padding

Conversation

@onmax

@onmax onmax commented Oct 27, 2026

Copy link
Copy Markdown
Owner

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.

  • The CLI test's box touches the image's top-left corner, so its number now moves inside the box (the existing rule for an image corner) instead of sliding along the top edge. The expectation is updated.
  • Other marks (`bracket`, `line`, `circle`) still scale their offsets with the image. They aren't part of this change.

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

… 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.
@vite-hub

vite-hub Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor
Session Status Started Duration
Pending Completed Not started —
View session Last seen running 2026-10-27T06:48:10.747Z 0s

Latest result

Pull request merged.

Final answers

Session

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.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-pad with a 6px default for controlling the box clearance.
  • Updated edge expectation: adjusts the CLI render assertion for a box at the image's top-left corner.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-5.6-sol | 𝕏

Comment thread packages/annotate/src/styles.ts Resolved
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ dec5e23 2026-10-27T06:48:03.780Z Visit the dashboard ↗
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ 606417e 2026-10-27T06:27:42.342Z Visit the dashboard ↗

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-pad to 0 for 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.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-5.6-sol | 𝕏

Comment thread packages/charts/src/styles.ts Resolved
@pkg-pr-new

pkg-pr-new Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

comark-annotate

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-annotate@230

comark-badge

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-badge@230

comark-cards

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-cards@230

comark-carousel

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-carousel@230

comark-cast

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-cast@230

comark-charts

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-charts@230

comark-chat

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-chat@230

comark-chips

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-chips@230

comark-cjk

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-cjk@230

comark-code

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-code@230

comark-code-notes

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-code-notes@230

comark-colors

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-colors@230

comark-critic

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-critic@230

comark-deflist

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-deflist@230

comark-details

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-details@230

comark-diagrams

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-diagrams@230

comark-diff

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-diff@230

comark-embed

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-embed@230

comark-fields

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-fields@230

comark-figure

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-figure@230

comark-file-tree

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-file-tree@230

comark-footnotes

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-footnotes@230

comark-github

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-github@230

comark-icon

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-icon@230

comark-include

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-include@230

comark-keys

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-keys@230

comark-links

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-links@230

comark-linter

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-linter@230

comark-mark

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-mark@230

comark-mathml

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-mathml@230

comark-media

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-media@230

comark-metrics

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-metrics@230

comark-outline

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-outline@230

comark-properties

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-properties@230

comark-qr

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-qr@230

comark-quiz

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-quiz@230

comark-reading-time

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-reading-time@230

comark-sources

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-sources@230

comark-steps

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-steps@230

comark-table

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-table@230

comark-tabs

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-tabs@230

comark-tests

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-tests@230

comark-ui

pnpm add https://pkg.pr.new/onmax/comark-ui@230

comark-xref

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-xref@230

comark-zoom

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-zoom@230

commit: d1e4cf5

@vite-hub

vite-hub Bot commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

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 left:-4px. For the CSS customization finding, screenshot clearance stays fixed at 6px using a shared default; the new --ca-pad variable and documentation were removed, preserving screenshot and chart defaults without promising CSS overrides that server-side placement cannot measure.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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_PADDING for both default CSS rendering and server-side stamp placement, while removing the independently overridable --ca-pad variable.
  • Threaded effective geometry: added boxPadding through annotateHtml(), figure(), and parts() so rendering and place() 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.

Pullfrog  | View workflow run | Using gpt-5.6-sol | 𝕏

@vite-hub
vite-hub Bot merged commit 7006271 into main Oct 27, 2026
8 checks passed
@vite-hub
vite-hub Bot deleted the fix/annotate-box-padding branch October 27, 2026 07:10
This was referenced Oct 27, 2026
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