Table of contents

Public class

Signature
class DrawShapeUtil extends ShapeUtil<TLDrawShape> {}
References

ShapeUtil, TLDrawShape

Source

packages/tldraw/src/lib/shapes/draw/DrawShapeUtil.tsx


Properties

hideResizeHandles

Public property

Signature
hideResizeHandles: (shape: TLDrawShape) => boolean
References

TLDrawShape


hideRotateHandle

Public property

Signature
hideRotateHandle: (shape: TLDrawShape) => boolean
References

TLDrawShape


hideSelectionBoundsFg

Public property

Signature
hideSelectionBoundsFg: (shape: TLDrawShape) => boolean
References

TLDrawShape


migrations

Public static property

Signature
static migrations: import('@tldraw/editor').TLShapePropsMigrations
References

TLShapePropsMigrations


onResize

Public property

Signature
onResize: TLOnResizeHandler<TLDrawShape>
References

TLOnResizeHandler, TLDrawShape


props

Public static property

Signature
static props: {
  color: import('@tldraw/editor').EnumStyleProp<
    | 'black'
    | 'blue'
    | 'green'
    | 'grey'
    | 'light-blue'
    | 'light-green'
    | 'light-red'
    | 'light-violet'
    | 'orange'
    | 'red'
    | 'violet'
    | 'white'
    | 'yellow'
  >
  dash: import('@tldraw/editor').EnumStyleProp<
    'dashed' | 'dotted' | 'draw' | 'solid'
  >
  fill: import('@tldraw/editor').EnumStyleProp<
    'none' | 'pattern' | 'semi' | 'solid'
  >
  isClosed: import('@tldraw/editor').Validator<boolean>
  isComplete: import('@tldraw/editor').Validator<boolean>
  isPen: import('@tldraw/editor').Validator<boolean>
  segments: import('@tldraw/editor').ArrayOfValidator<{
    points: import('@tldraw/editor').VecModel[]
    type: 'free' | 'straight'
  }>
  size: import('@tldraw/editor').EnumStyleProp<'l' | 'm' | 's' | 'xl'>
}
References

EnumStyleProp, Validator, ArrayOfValidator, VecModel


type

Public static property

Signature
static type: 'draw'

Methods

component()

Public method

Signature
component(shape: TLDrawShape): import('react/jsx-runtime').JSX.Element
Parameters
NameDescription

shape

TLDrawShape
Returns
import('react/jsx-runtime').JSX.Element
References

TLDrawShape


expandSelectionOutlinePx()

Public method

Signature
expandSelectionOutlinePx(shape: TLDrawShape): number
Parameters
NameDescription

shape

TLDrawShape
Returns
number
References

TLDrawShape


getCanvasSvgDefs()

Public method

Signature
getCanvasSvgDefs(): TLShapeUtilCanvasSvgDef[]
References

TLShapeUtilCanvasSvgDef


getDefaultProps()

Public method

Signature
getDefaultProps(): TLDrawShape['props']
References

TLDrawShape


getGeometry()

Public method

Signature
getGeometry(shape: TLDrawShape): Circle2d | Polyline2d
Parameters
NameDescription

shape

TLDrawShape
Returns
Circle2d | Polyline2d
References

TLDrawShape, Circle2d, Polyline2d


indicator()

Public method

Signature
indicator(shape: TLDrawShape): import('react/jsx-runtime').JSX.Element
Parameters
NameDescription

shape

TLDrawShape
Returns
import('react/jsx-runtime').JSX.Element
References

TLDrawShape


toSvg()

Public method

Signature
toSvg(
  shape: TLDrawShape,
  ctx: SvgExportContext
): import('react/jsx-runtime').JSX.Element
Parameters
NameDescription

shape

TLDrawShape

ctx

SvgExportContext
Returns
import('react/jsx-runtime').JSX.Element
References

TLDrawShape, SvgExportContext


DrawShapeToolDrawToolbarItem