Skip to content

fix(ink): keep smoothed ink inside export and selection bounds - #234

Merged
DWAA1660 merged 2 commits into
AlienTechSoftware:mainfrom
DWAA1660:fix/smoothed-ink-bounds/231
Nov 14, 2026
Merged

DWAA1660 merged 2 commits into
AlienTechSoftware:mainfrom
DWAA1660:fix/smoothed-ink-bounds/231

Conversation

@DWAA1660

Copy link
Copy Markdown
Collaborator

Smoothed ink could extend beyond its raw readings, while Stroke::bounds only enclosed those readings. This put selection handles inside visible ink and let the saved SVG viewport crop a curve. In the four-reading reproduction, the outline reaches y -15.57 but the exported viewport begins at -2. The real SVG rasterizer confirms clipped pixels in both Plain and Editable exports.

Stroke::bounds now unions the original extrema with the same sampled centreline used by the painter and SVG outline. It retains the selected full-width padding, existing sheet area, and unchanged dot/two-reading behavior. Drawing::add, drawing bounds and selection bounds inherit the correction. Stored readings and pressure are unchanged. No renderer or hit-test code changes.

Fixes #231. This is separate from the cap-angle fix #218 and pressure-aware hit testing #230.

Validation

  • New bounds and actual SVG-raster regressions failed before the fix, then passed.
  • cargo test -p notecraft-ink: 42 existing tests and 3 new regressions passed. Cases cover rotation, reversal, all tools, pressure, full-width padding, existing sheet area, selection bounds and stable Editable rereading.
  • cargo test -p notecraft-ui-egui --test ink_svg_bounds: passed. It uses the existing SVG loader for real Plain/Editable exports, with an expanded-viewport control whose paths and readings are identical.
  • cargo xtask demo and cargo xtask demo-check: passed; generation produced no tracked notebook changes, and all 662 generated files match the source.
  • cargo test -p notecraft-formats --test format_parity: 3 passed.
  • Diagnostic Plain/Editable renders were reviewed. The reproduction loses 64 opaque pixels before the fix and zero after; both flavours render identically.
  • Enabled commit hooks passed. The normal push retains the repository's required full pre-push gate.

Hosted platform, coverage and WASM results will be reported by CI. No new dependencies or test doubles were added.

The normal pre-push gate completed successfully: cargo xtask ci reported all checks passed.

@DWAA1660
DWAA1660 merged commit 9892677 into AlienTechSoftware:main Nov 14, 2026
10 checks passed
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.

[BUG] Smoothed ink extends outside selection bounds and is clipped in saved SVG

1 participant