Repository navigation
Fix/block text bbox and panel - #100
Merged
Merged
Conversation
The Transformer's selection bbox for ^FB text used to follow the rendered glyph spans, so C/R-justified text pulled the left edge rightwards away from the field anchor. Pin the bbox with an invisible Rect at (0,0)-(blockWidth, blockHeight) inside the field Group so the selection always covers the full block extent at the FO position. Extract blockBoundsPx() to zebraTextLayout for unit tests that pin the (0,0)-anchor + dimension contract. Restructure BlockTextSettings: indent + left-border marks the sub- panel as belonging to the FELDBLOCK checkbox (same convention as the Font-Advanced block), justify becomes an inline mini-toolbar (label left, four fixed-width icon buttons right) freeing the ~110px grid cell that previously collided with ZEILENABSTAND, and the number-input grid uses items-end so wrapped labels keep their inputs aligned.
Lift `blockBoundsDots` to pure ZPL-dot space (no Konva-pixel inputs) so the helper is reusable by future consumers (ZPL generator, pixel- regression renderer) without forcing them to pre-multiply by scale. Drop the literal-typed (0,0) anchor to widen consumer-side destructuring; the anchor invariant lives in the doc comment. Extract `blockLineStepDots` so block-area height and per-line text rendering share one row-step definition. Replace the tautological "ignores text/justify" test (it just checked determinism) with an explicit assertion in the (0,0)-anchor test, where the missing parameter list is the real contract. BlockTextSettings: drop the single-child grid wrapper around ZEILENABSTAND in favour of an explicit `w-1/2` row, and split the multi-topic layout comment to sit next to the rule it explains.
There was a problem hiding this comment.
Code Review
This pull request introduces a visual block wrap guide and selection anchor bounding box for text blocks on the canvas, ensuring the selection bounds align correctly with the field anchor regardless of text justification. However, the review identified two critical issues: first, removing the useMemo hook around the active CSV row calculation defeats downstream identity-preservation and causes unnecessary canvas re-renders; second, the block height calculation incorrectly adds an extra line spacing at the bottom of the block, which deviates from the actual rendered layout and ZPL generation.
`blockBoundsDots` was computing height as `lines × (fontHeight + spacing)`, which adds one spacing too many at the bottom. N lines have only N-1 inter-line gaps, matching the existing ZPL emit formula in text.tsx (`fontHeight * lines + spacing * (lines - 1)`). Effect: with non-zero blockLineSpacing the canvas wrap guide and Transformer selection extended past the actual printed block by exactly one spacing unit. Now the on-screen bbox matches Labelary. Single-line and zero-line edge cases added to the test suite.
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.
No description provided.