Skip to content

Fix/gs1databar rotation fill#56

Merged
u8array merged 3 commits into
mainfrom
fix/gs1databar-rotation-fill
May 11, 2026
Merged

Fix/gs1databar rotation fill#56
u8array merged 3 commits into
mainfrom
fix/gs1databar-rotation-fill

Conversation

@u8array
Copy link
Copy Markdown
Owner

@u8array u8array commented May 11, 2026

No description provided.

u8array added 3 commits May 11, 2026 22:10
…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.
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

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.

@u8array u8array merged commit d017c55 into main May 11, 2026
2 checks passed
@u8array u8array deleted the fix/gs1databar-rotation-fill branch May 11, 2026 21:14
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