Skip to content

Add Designer v2: Fabric.js label editor with queue, shapes, and smart snapping#27

Merged
AlexNly merged 7 commits into
mainfrom
feature/designer-v2
Feb 2, 2026
Merged

Add Designer v2: Fabric.js label editor with queue, shapes, and smart snapping#27
AlexNly merged 7 commits into
mainfrom
feature/designer-v2

Conversation

@AlexNly

@AlexNly AlexNly commented Feb 2, 2026

Copy link
Copy Markdown
Owner

Summary

Adds Designer v2 — a full Fabric.js-based label editor available as a tab alongside the existing photo flow. Built across three phases:

Phase 1 — Core editor (1d5b9a3)

  • Fabric.js canvas sized to media dimensions from /api/public-config
  • Text tool with font size control and inline editing
  • Grid overlay with snap-to-grid
  • Preview/print integration (exports canvas to PNG, POSTs to existing endpoints)
  • Template CRUD: save/load/delete via new /api/templates API (JSON file storage)
  • Tab navigation between Photo and Designer (no page reload)

Phase 2 — Queue and images (42c477d, 3b9b3d6)

  • Multi-label queue: add labels, reorder via drag-and-drop, print all sequentially
  • Image tool: add photos to canvas with auto-scaling to 80% of bounds
  • Smart snapping (PowerPoint-style): object-to-object and canvas edge/center alignment with dashed blue guide lines
  • Clean JSON export strips grid lines and snap guides from templates and queue items

Phase 3 — Shapes, fonts, and polish (1db3b0d)

  • Shape tools: rectangle, circle, line
  • Font picker with 6 web-safe fonts
  • Fill color toggle (black/white)
  • Object layering controls (bring forward/send backward)
  • Queue duplication
  • Touch-optimized handles and snap thresholds

Other (7935a77)

  • USB direct-write support in spool_raw(): when printer_name starts with /dev/, writes directly to the device instead of going through CUPS/lpr

Files changed

  • ditherbooth/static/designer-v2.js — 881-line Fabric.js editor (new)
  • ditherbooth/static/index.html — tab bar, designer container, toolbar markup
  • ditherbooth/static/style.css — designer layout, queue strip, toolbar styles
  • ditherbooth/static/app.js — tab switching, initDesignerV2() / onDesignerTabVisible() hooks
  • ditherbooth/app.py — template CRUD endpoints, design_mode in public config
  • ditherbooth/printer/cups.py — USB device direct-write path
  • tests/test_templates.py — template API tests (new)
  • CLAUDE.md — updated documentation

Test plan

  • Verify Designer tab loads and canvas renders at correct media dimensions
  • Add text, shapes, and images; confirm snap guides appear when dragging near edges/objects
  • Save a template, reload page, verify it loads from the template list
  • Add multiple labels to queue, reorder via drag, print queue in sequence
  • Test preview and print with a real or test-mode printer
  • Run pytest to confirm template API tests pass
  • Verify photo tab still works as before (no regressions)

AlexNly and others added 6 commits October 5, 2025 18:57
…pping, and template CRUD

Rebuilds the designer as an inline tab alongside the photo flow using Fabric.js.
Adds server-side template persistence, grid with snap-to-grid, text elements,
preview/print integration, and responsive layout.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Smart snap guides (PowerPoint-style) with object-to-object and canvas
edge/center alignment. Image tool for adding photos to canvas with
auto-scaling. Clean JSON export strips grid/snap guides from templates
and queue items.
…esigner v2

Phase 3 finishing touches: shape tool (rect/circle/line), font dropdown,
black/white fill toggle, object layering controls (bring forward/send
backward), queue duplicate button, and touch-optimized handles and snap
thresholds.
@codecov

codecov Bot commented Feb 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.01325% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
ditherbooth/app.py 93.87% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7935a77cc1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +771 to +775
// Load JSON onto the main canvas temporarily, export, then we don't restore
// (caller is iterating the queue so each load is intentional)
canvas.loadFromJSON(canvasJSON, () => {
canvas.renderAll();
const dataURL = canvas.toDataURL({ format: 'png', multiplier: 1 });

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve current canvas when printing queue

The queue print path loads each queued item into the main Fabric canvas to generate a blob and never restores the previous canvas state. This means if a user has an in‑progress design on the canvas and clicks “Print Queue,” their current work will be replaced by the last queued label after printing completes. That is data loss unless the user saved it elsewhere. Consider caching the current canvas JSON before printQueue() starts and restoring it afterward, or rendering queue items on an offscreen Fabric canvas so the editor state remains untouched.

Useful? React with 👍 / 👎.

Cover the /dev/ direct-write branch and lpr branch in spool_raw,
GET template by ID, template 404, and media_dimensions in public config.
@AlexNly AlexNly merged commit 125e548 into main Feb 2, 2026
3 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.

1 participant