implement datamatrix 2D code#127
Open
bfour wants to merge 3 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces DataMatrix (2D) code support in the label designer by adding a new Fabric object implementation and wiring it into canvas utilities and the Svelte UI.
Changes:
- Added a new
DataMatrixFabric object rendered viabwip-js. - Integrated DataMatrix into object creation, canvas preprocessing/scale rules, and designer panels.
- Updated dependencies (added
bwip-js+ typings) and introduced ayarn.lock.
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Adds a Yarn lockfile containing the resolved dependency graph. |
| package.json | Adds bwip-js and @types/bwip-js dependencies. |
| src/fabric-object/datamatrix.ts | Implements a new Fabric object that renders DataMatrix codes using bwip-js. |
| src/types.ts | Extends OjectType union with "datamatrix". |
| src/utils/label_designer_object_helper.ts | Adds creation helper and object-picker dispatch for DataMatrix. |
| src/utils/canvas_utils.ts | Treats DataMatrix as non-scalable and enforces even/min size similar to QR/ArUco. |
| src/utils/canvas_preprocess.ts | Applies variable preprocessing to DataMatrix text content. |
| src/components/LabelDesigner.svelte | Shows DataMatrix parameter panel and enables variable insertion for DataMatrix. |
| src/components/designer-controls/DataMatrixParamsControls.svelte | Adds a simple textarea-based params control for DataMatrix text. |
| src/components/designer-controls/VariableInsertControl.svelte | Allows inserting variables into DataMatrix content. |
| src/components/designer-controls/ObjectPositionControls.svelte | Excludes DataMatrix from manual width/height editing (like QR). |
| src/components/designer-controls/ObjectPicker.svelte | Adds a DataMatrix object button to the picker UI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
MultiMote
requested changes
Apr 4, 2026
Owner
There was a problem hiding this comment.
Hello. Thanks for your contribution.
You are using bwip-js just for DataMatrix rendering. It supports a LOT of 1D/2D codes, but none of them were used and the bundle size has increased by 1 MB.
It might be better if you used more specialized libraries, such as https://github.com/damischa1/datamatrix-svg-ts
e5381e7 to
e05c73a
Compare
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.