Skip to content

fix(gs1databar): canvas resize maps the width drag onto magnification - #582

Merged
u8array merged 2 commits into
u8array:mainfrom
Devority:fix/gs1databar-canvas-resize
Oct 23, 2026
Merged

u8array merged 2 commits into
u8array:mainfrom
Devority:fix/gs1databar-canvas-resize

Conversation

@Devority

Copy link
Copy Markdown

Summary

GS1 DataBar showed no resize handles on the canvas: heightLocked: true short-circuits enabledAnchors to [], disabling the transformer entirely. But only the height axis is firmware-fixed (Zebra overrides ^BR h for symbologies 1–5; Expanded Stacked uses it as per-row height) — the width axis is adjustable via ^BR magnification 1–10, which the properties panel already edits.

Changes:

  • gs1databar gains a commitTransform that maps the rotation-aware width-axis scale onto magnification, clamped to the ^BR 1–10 range.
  • The transformer mounts the module-width-axis anchors for a heightLocked code-1d type (middle-left/right for N/I, top/bottom-center for R/B — the bars turn a quarter).
  • The 1D module-width anchor snap, live reflow and release commit resolve the module prop generically (moduleWidth on ^BY symbologies, magnification on GS1 DataBar) instead of hardcoding the name — so the drag quantises and re-renders per integer step exactly like the other 1D barcodes.
  • Registry invariant: a heightLocked code-1d type must still commit the module-width axis (code-2d heightLocked types like MaxiCode keep skipping the transformer entirely, since ^BD has no size parameter at all).

Test plan

  • pnpm test — new gs1databar.test.ts covers the commit contract (horizontal scaling, height ignored, 1–10 clamp, R/B axis swap); registry.test.ts pins the invariant
  • tsc -b and eslint clean
  • Manual: dragged a GS1 DataBar's right edge on the canvas — magnification goes 2 → 3 and the barcode re-renders wider

Generated with Devin

@u8array

u8array commented Oct 23, 2026

Copy link
Copy Markdown
Owner

Since the PR is Devin-generated, I'll take it from here and push the remaining changes on top instead of a review round.

@u8array
u8array force-pushed the fix/gs1databar-canvas-resize branch from 7fecd75 to 6c0f513 Compare October 23, 2026 21:00
@u8array
u8array merged commit 48d6ed8 into u8array:main Oct 23, 2026
2 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.

2 participants