Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/components/Canvas/BarcodeObject.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export function BarcodeObject({
let barcodeCanvas: HTMLCanvasElement | null = null;
let errorMsg: string | null = null;
if (obj.type === "tlc39") {
// bwip-js has no native tlc39 encoder; render the Code 39 + MicroPDF417
// bwip-js has no native tlc39 encoder, render the Code 39 + MicroPDF417
// composite ourselves. Goes straight to canvas, bypassing buildBwipOptions.
barcodeCanvas = renderTlc39Canvas(obj.props, scale, dpmm);
if (!barcodeCanvas) errorMsg = "TLC39 render failed";
Expand Down Expand Up @@ -188,7 +188,7 @@ export function BarcodeObject({
// selectively skips bwip's internal padding (e.g. GS1 DataBar's
// paddingheight rows) so bars fill the bbox at firmware-correct height.
const bitmapCrop = dim.bitmapCrop;
// Force-off when the symbology has no HRI in ZPL (e.g. GS1 Databar) — the
// Force-off when the symbology has no HRI in ZPL (e.g. GS1 Databar); the
// canvas must match the print output even if a legacy saved object still
// carries printInterpretation: true.
const rotation = objectRotation(obj.props);
Expand Down Expand Up @@ -268,15 +268,15 @@ export function BarcodeObject({
});
// EAN/UPC have barTopPx === 0 (no text zone above), so the
// helper's bar-relative textY equals the bbox-relative one
// here — render directly without an offset wrapper.
// here; render directly without an offset wrapper.
overlayContent = eanOverlay.nodes;
} else {
// Other 1D: single centered text. textRef is wired only for the
// upright case so handleTransform/End can counter-scale it; for
// rotated paths the counter-scale math doesn't apply (would
// scale along upright-Y which after R/B is screen-X), so the
// ref stays undefined and the bars+text just scale together
// during a rotated resize drag — minor visual nit, no broken
// during a rotated resize drag, a minor visual nit with no broken
// print output.
// Compensate Courier's em-bottom padding only on the ink-height path.
const inkShiftPx = hri?.fontDots ? textFontSize * COURIER_BOLD_EM_BOTTOM_PAD : 0;
Expand Down Expand Up @@ -323,7 +323,7 @@ export function BarcodeObject({
txt.y(textLocalY(1));
};

// Clip-expansion is upright-EAN/UPC only; absent on other paths
// Clip-expansion is upright-EAN/UPC only, absent on other paths
// so Konva computes a natural bbox. Spread-or-empty keeps the
// JSX free of four parallel ternaries.
const clipProps = isUprightEanUpc && eanOverlay
Expand Down
2 changes: 1 addition & 1 deletion src/components/Canvas/Grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function Grid({
const right = labelOffsetX + labelWidthPx;
const bottom = labelOffsetY + labelHeightPx;

// Snap grid (primary — always visible, matches snap interval)
// Snap grid (primary; always visible, matches snap interval)
for (let x = labelOffsetX + snapPx; x < right; x += snapPx) {
lines.push(
<Line key={`vs-${x}`} points={[x, labelOffsetY, x, bottom]}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Canvas/GuideLines.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Group, Line } from 'react-konva';
import type { SnapGuide } from '../../lib/snapGuides';

// Soft indigo — visible on white labels without being aggressive
// Soft indigo; visible on white labels without being aggressive
const COLOR = '#818cf8';
const TICK = 4; // half-length of tick marks on spacing guides

Expand Down
4 changes: 2 additions & 2 deletions src/components/Canvas/ImageObject.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type Props = Omit<KonvaObjectProps, "obj"> & { obj: ImageLabelObject };
/** Image renderer. Hosted as its own component so hooks (useState/
* useEffect for async image loading) can run without violating
* rules-of-hooks. The dispatcher in KonvaObject narrows `obj`
* before passing — no runtime cast needed here. */
* before passing; no runtime cast needed here. */
export function ImageObject({
obj,
scale,
Expand All @@ -31,7 +31,7 @@ export function ImageObject({
const w = dotsToPx(p.widthDots, scale, dpmm);
// Aspect-lock when a real PNG is cached; fall back to `heightDots` for
// recall-only placeholders so the user can shape the box freely. Guard
// against 0-width cached images (malformed file edge case) — div-by-
// against 0-width cached images (malformed file edge case); div-by-
// zero would otherwise render NaN-sized canvas nodes.
const h = cached && cached.width > 0
? w * (cached.height / cached.width)
Expand Down
226 changes: 41 additions & 185 deletions src/components/Canvas/KonvaObject.tsx

Large diffs are not rendered by default.

179 changes: 34 additions & 145 deletions src/components/Canvas/LabelCanvas.tsx

Large diffs are not rendered by default.

Loading