feat(staged): warn when pikchr elements extend beyond diagram bounds#872
Merged
Conversation
The generate_pikchr preview analysis only flagged overlapping elements, so text laid out wider than Pikchr's own width estimates could spill past the diagram edge and get clipped without the inner specialist session ever hearing about it. Extend the preview's layout analysis to also compare every box and label rectangle against the diagram's drawing area (the 0-origin viewBox), reusing the same per-kind hairline thresholds as overlap detection so font-metric noise isn't flagged. Out-of-bounds elements are reported in the preview summary with per-edge overhang distances plus repair advice, and the sub-session repair loop now re-prompts on them exactly like overlap warnings via a generalized layout-warning prompt. Covered by unit tests for the detector, summary, and preview flag, and a sub-session test that repairs an out-of-bounds render (via a negative-margin fixture whose box geometry crosses the canvas edge independent of host fonts). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Matt Toohey <contact@matttoohey.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
generate_pikchrpreview analysis only flagged overlapping elements, so text laid out wider than Pikchr's own width estimates could spill past the diagram edge and get clipped without the inner specialist session ever hearing about it.Testing
🤖 Generated with Claude Code