tldraw/tldraw

Export addRoundedRectPath utility for SDK consumers

Open

#8.907 aberto em 20 de mai. de 2026

Ver no GitHub
 (6 comments) (0 reactions) (1 assignee)TypeScript (3.212 forks)batch import
good first issueimprovementsdk

Métricas do repositório

Stars
 (47.037 stars)
Métricas de merge de PR
 (Mesclagem média 5d 4h) (227 fundiu PRs em 30d)

Description

Problem

addRoundedRectPath() is a generic Path2D helper that draws a rounded rectangle (optionally counter-clockwise, for use as a clip-path cutout). It currently lives as a private function inside packages/tldraw/src/lib/shapes/arrow/ArrowShapeUtil.tsx, so SDK consumers cannot reuse it when building custom shape utils.

The function has no arrow-specific behavior. It is useful for any custom shape that needs to:

  • Build a label-cutout clip path (the arrow's own use case).
  • Render a rounded-rect indicator path.
  • Generally produce a rounded-rect Path2D without manually writing the arc math.

Proposed solution

Move addRoundedRectPath to a shared location alongside the other shape helpers (for example packages/tldraw/src/lib/shapes/shared/, next to PathBuilder), and re-export it from the tldraw package entry point so consumers can import it the same way they import PathBuilder today.

Also, change the oxlint plugin linter hint to properly reference this helper, instead of telling the dev to make the roundrect manually

Current location

packages/tldraw/src/lib/shapes/arrow/ArrowShapeUtil.tsx:91

Guia do colaborador