Table of contents

Public class

Signature
class GeoShapeUtil extends BaseBoxShapeUtil<TLGeoShape> {}
References

BaseBoxShapeUtil, TLGeoShape

Source

packages/tldraw/src/lib/shapes/geo/GeoShapeUtil.tsx


Properties

canEdit

Public property

Signature
canEdit: () => boolean

migrations

Public static property

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

TLPropsMigrations


onBeforeCreate

Public property

Signature
onBeforeCreate: (shape: TLGeoShape) =>
  | {
      id: import('@tldraw/editor').TLShapeId
      index: import('@tldraw/editor').IndexKey
      isLocked: boolean
      meta: import('@tldraw/editor').JsonObject
      opacity: number
      parentId: import('@tldraw/editor').TLParentId
      props: {
        align:
          | 'end-legacy'
          | 'end'
          | 'middle-legacy'
          | 'middle'
          | 'start-legacy'
          | 'start'
        color:
          | 'black'
          | 'blue'
          | 'green'
          | 'grey'
          | 'light-blue'
          | 'light-green'
          | 'light-red'
          | 'light-violet'
          | 'orange'
          | 'red'
          | 'violet'
          | 'white'
          | 'yellow'
        dash: 'dashed' | 'dotted' | 'draw' | 'solid'
        fill: 'none' | 'pattern' | 'semi' | 'solid'
        font: 'draw' | 'mono' | 'sans' | 'serif'
        geo:
          | 'arrow-down'
          | 'arrow-left'
          | 'arrow-right'
          | 'arrow-up'
          | 'check-box'
          | 'cloud'
          | 'diamond'
          | 'ellipse'
          | 'hexagon'
          | 'octagon'
          | 'oval'
          | 'pentagon'
          | 'rectangle'
          | 'rhombus-2'
          | 'rhombus'
          | 'star'
          | 'trapezoid'
          | 'triangle'
          | 'x-box'
        growY: number
        h: number
        labelColor:
          | 'black'
          | 'blue'
          | 'green'
          | 'grey'
          | 'light-blue'
          | 'light-green'
          | 'light-red'
          | 'light-violet'
          | 'orange'
          | 'red'
          | 'violet'
          | 'white'
          | 'yellow'
        size: 'l' | 'm' | 's' | 'xl'
        text: string
        url: string
        verticalAlign: 'end' | 'middle' | 'start'
        w: number
      }
      rotation: number
      type: 'geo'
      typeName: 'shape'
      x: number
      y: number
    }
  | undefined
References

TLGeoShape, TLShapeId, TLParentId


onBeforeUpdate

Public property

Signature
onBeforeUpdate: (
  prev: TLGeoShape,
  next: TLGeoShape
) =>
  | {
      id: import('@tldraw/editor').TLShapeId
      index: import('@tldraw/editor').IndexKey
      isLocked: boolean
      meta: import('@tldraw/editor').JsonObject
      opacity: number
      parentId: import('@tldraw/editor').TLParentId
      props: {
        align:
          | 'end-legacy'
          | 'end'
          | 'middle-legacy'
          | 'middle'
          | 'start-legacy'
          | 'start'
        color:
          | 'black'
          | 'blue'
          | 'green'
          | 'grey'
          | 'light-blue'
          | 'light-green'
          | 'light-red'
          | 'light-violet'
          | 'orange'
          | 'red'
          | 'violet'
          | 'white'
          | 'yellow'
        dash: 'dashed' | 'dotted' | 'draw' | 'solid'
        fill: 'none' | 'pattern' | 'semi' | 'solid'
        font: 'draw' | 'mono' | 'sans' | 'serif'
        geo:
          | 'arrow-down'
          | 'arrow-left'
          | 'arrow-right'
          | 'arrow-up'
          | 'check-box'
          | 'cloud'
          | 'diamond'
          | 'ellipse'
          | 'hexagon'
          | 'octagon'
          | 'oval'
          | 'pentagon'
          | 'rectangle'
          | 'rhombus-2'
          | 'rhombus'
          | 'star'
          | 'trapezoid'
          | 'triangle'
          | 'x-box'
        growY: number
        h: number
        labelColor:
          | 'black'
          | 'blue'
          | 'green'
          | 'grey'
          | 'light-blue'
          | 'light-green'
          | 'light-red'
          | 'light-violet'
          | 'orange'
          | 'red'
          | 'violet'
          | 'white'
          | 'yellow'
        size: 'l' | 'm' | 's' | 'xl'
        text: string
        url: string
        verticalAlign: 'end' | 'middle' | 'start'
        w: number
      }
      rotation: number
      type: 'geo'
      typeName: 'shape'
      x: number
      y: number
    }
  | undefined
References

TLGeoShape, TLShapeId, TLParentId


onDoubleClick

Public property

Signature
onDoubleClick: (shape: TLGeoShape) =>
  | {
      id: import('@tldraw/editor').TLShapeId
      index: import('@tldraw/editor').IndexKey
      isLocked: boolean
      meta: import('@tldraw/editor').JsonObject
      opacity: number
      parentId: import('@tldraw/editor').TLParentId
      props: {
        geo: 'check-box'
      }
      rotation: number
      type: 'geo'
      typeName: 'shape'
      x: number
      y: number
    }
  | {
      id: import('@tldraw/editor').TLShapeId
      index: import('@tldraw/editor').IndexKey
      isLocked: boolean
      meta: import('@tldraw/editor').JsonObject
      opacity: number
      parentId: import('@tldraw/editor').TLParentId
      props: {
        geo: 'rectangle'
      }
      rotation: number
      type: 'geo'
      typeName: 'shape'
      x: number
      y: number
    }
  | undefined
References

TLGeoShape, TLShapeId, TLParentId


onEditEnd

Public property

Signature
onEditEnd: TLOnEditEndHandler<TLGeoShape>
References

TLOnEditEndHandler, TLGeoShape


onResize

Public property

Signature
onResize: TLOnResizeHandler<TLGeoShape>
References

TLOnResizeHandler, TLGeoShape


props

Public static property

Signature
static props: {
  align: import('@tldraw/editor').EnumStyleProp<
    | 'end-legacy'
    | 'end'
    | 'middle-legacy'
    | 'middle'
    | 'start-legacy'
    | 'start'
  >
  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'
  >
  font: import('@tldraw/editor').EnumStyleProp<
    'draw' | 'mono' | 'sans' | 'serif'
  >
  geo: import('@tldraw/editor').EnumStyleProp<
    | 'arrow-down'
    | 'arrow-left'
    | 'arrow-right'
    | 'arrow-up'
    | 'check-box'
    | 'cloud'
    | 'diamond'
    | 'ellipse'
    | 'hexagon'
    | 'octagon'
    | 'oval'
    | 'pentagon'
    | 'rectangle'
    | 'rhombus-2'
    | 'rhombus'
    | 'star'
    | 'trapezoid'
    | 'triangle'
    | 'x-box'
  >
  growY: import('@tldraw/editor').Validator<number>
  h: import('@tldraw/editor').Validator<number>
  labelColor: import('@tldraw/editor').EnumStyleProp<
    | 'black'
    | 'blue'
    | 'green'
    | 'grey'
    | 'light-blue'
    | 'light-green'
    | 'light-red'
    | 'light-violet'
    | 'orange'
    | 'red'
    | 'violet'
    | 'white'
    | 'yellow'
  >
  size: import('@tldraw/editor').EnumStyleProp<'l' | 'm' | 's' | 'xl'>
  text: import('@tldraw/editor').Validator<string>
  url: import('@tldraw/editor').Validator<string>
  verticalAlign: import('@tldraw/editor').EnumStyleProp<
    'end' | 'middle' | 'start'
  >
  w: import('@tldraw/editor').Validator<number>
}
References

EnumStyleProp, Validator


type

Public static property

Signature
static type: 'geo'

Methods

component()

Public method

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

shape

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

TLGeoShape


getCanvasSvgDefs()

Public method

Signature
getCanvasSvgDefs(): TLShapeUtilCanvasSvgDef[]
References

TLShapeUtilCanvasSvgDef


getDefaultProps()

Public method

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

TLGeoShape


getGeometry()

Public method

Signature
getGeometry(shape: TLGeoShape): Group2d
Parameters
NameDescription

shape

TLGeoShape
Returns
Group2d
References

TLGeoShape, Group2d


getHandleSnapGeometry()

Public method

Signature
getHandleSnapGeometry(shape: TLGeoShape): HandleSnapGeometry
Parameters
NameDescription

shape

TLGeoShape
Returns
HandleSnapGeometry
References

TLGeoShape, HandleSnapGeometry


indicator()

Public method

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

shape

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

TLGeoShape


toSvg()

Public method

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

shape

TLGeoShape

ctx

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

TLGeoShape, SvgExportContext


GeoShapeToolGeoStylePickerSet