Fix/gs1databar rotation fill#56
Merged
Merged
Conversation
…ation The bwip-js paddingheight=2 rows sit on top and bottom of the *upright* bitmap. After bwip rotates the symbol (rotate='R' or 'L' for ZPL B), those rows end up on the left and right edges of the rotated bitmap, so the existing y-axis crop was slicing into the bar pattern rather than the padding — leaving visible gaps between the bars and the bbox in canvas rendering. Now the crop axis follows the rotation: y for N / I (padding stays top/bottom) and x for R / B (padding moved to left/right).
…form Two changes to the floating 90 deg quick-rotate button: 1. Hook dragmove and transform (not just dragstart / dragend) so the anchor recomputes per frame instead of staying frozen until the interaction ends — drops the isInteracting hide that was masking the lag with a frame of invisibility. 2. Update the button's Konva node imperatively through a ref in addition to setState. The React state path adds a frame of latency relative to Konva's native drag updates, which showed as a small wobble. Writing the position straight to Konva keeps both painters on the same frame; the React state stays in sync so non-drag re-renders start from the latest position.
Two clean-up sweeps after the audit: 1. The bwip option (paddingheight: 2) and the matching bitmap-crop logic both hard-coded the row count, so a change to one would silently desync the other. Lifted the value into bwipConstants.ts as GS1_DATABAR_PADDING_ROWS and reused at both sites. 2. The rotation-axis-aware crop split into mirror-image if/else branches around isQuarter. Single guard, single ternary for the axis-specific shape keeps the intent visible without the duplicated check.
There was a problem hiding this comment.
Code Review
This pull request optimizes the rotation button's positioning by using a React ref to update the Konva node directly during interactions, which prevents the UI from lagging behind the cursor. Additionally, it refactors GS1 DataBar padding into a shared constant and updates the bitmap cropping logic to correctly handle rotated barcodes. I have no further feedback to provide as there were no review comments.
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.