Skip to content

feat: cylinder (database) shape tool - #116

Merged
Amark19 merged 2 commits into
masterfrom
feat/cylinder-shape
Aug 24, 2026
Merged

Amark19 merged 2 commits into
masterfrom
feat/cylinder-shape

Conversation

@Amark19

@Amark19 Amark19 commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

What changed

Adds a database cylinder primitive — the first P0 building block for the AI-diagram track, and useful on its own.

  • New toolbar button (lucide Cylinder, between Polygon and Line).
  • Drag-to-size draw (grows from the drag corner like the rectangle), plus click-to-drop a default size.
  • It's a plain fabric.Path, so it styles (stroke / fill / width / dash) and binds like any shape — arrows attach to its border and stay glued when it moves.

Wired through the same points every shape uses: tools/cylinder.js, tools/index.js, assignUtil.js, constants/tools.js, constants/IconTools.js, and STYLEABLE_TOOLS in the panel.

One implementation note

The cylinder's rim arcs bulge to the box edges, but fabric's arc bounding-box misses the bottom bulge (reports height short). Since the geometry spans exactly the drag box, width/height/pathOffset are set explicitly so selection and binding match what's drawn.

Test plan

  • New cylinder.test.js: drag-to-size dimensions, up/left drag, click-to-default, and isBindable. 89 tests pass; lint + prettier clean.
  • Verified in-browser: draw via toolbar → renders as a proper DB cylinder; picks up the current style at draw time; an arrow binds to its border and tracks it when moved.

🤖 Generated with Claude Code

Add a database-cylinder primitive: toolbar button, drag-to-size draw, and full
style support. It's a plain fabric.Path so it styles (stroke/fill/width/dash)
and binds like any other shape — arrows attach to its border and follow it.

The rim arcs bulge to the box edges but fabric's arc bbox misses the bottom
bulge, so width/height/pathOffset are set to the true box (selection + binding
match what's drawn).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 24, 2026 •

Copy link
Copy Markdown

Deploying whiteboard with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2982288
Status: ✅  Deploy successful!
Preview URL: https://a872137a.whiteboard-988.pages.dev
Branch Preview URL: https://feat-cylinder-shape.whiteboard-988.pages.dev

View logs

The arc-based path had wrong sweep directions so a filled cylinder pinched at
the sides and left the bottom crescent unfilled (only showed with a fill — the
first pass was tested transparent). Rebuild the rims from cubic beziers:
straight sides, back top rim (up), front bottom rim (down); fill covers the
whole body incl. the top ellipse band, with the front lid rim stroked on top.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Amark19
Amark19 merged commit 7329d5d into master Aug 24, 2026
2 checks passed
@Amark19
Amark19 deleted the feat/cylinder-shape branch August 24, 2026 15:21
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