TLTextUtil
Public Class
Table of Contents
Signature
class TLTextUtil extends TLShapeUtil<TLTextShape> {}
References
Properties
canEdit
Public Property
Signature
canEdit: () => boolean
isAspectRatioLocked
Public Property
Signature
isAspectRatioLocked: TLShapeUtilFlag<TLTextShape>
References
onBeforeCreate
Public Property
Signature
onBeforeCreate: (shape: TLTextShape) =>
  | {
      x: number
      y: number
      type: 'text'
      rotation: number
      index: string
      parentId: import('@tldraw/tlschema').TLParentId
      isLocked: boolean
      props: import('@tldraw/tlschema').TLTextShapeProps
      id: import('@tldraw/tlstore').ID<TLTextShape>
      typeName: 'shape'
    }
  | undefined
References
TLTextShape, TLParentId, TLTextShapeProps, ID
onBeforeUpdate
Public Property
Signature
onBeforeUpdate: (
  prev: TLTextShape,
  next: TLTextShape
) =>
  | {
      x: number
      y: number
      props: {
        w: number
        color:
          | 'black'
          | 'blue'
          | 'green'
          | 'grey'
          | 'light-blue'
          | 'light-green'
          | 'light-red'
          | 'light-violet'
          | 'orange'
          | 'red'
          | 'violet'
          | 'yellow'
        size: 'l' | 'm' | 's' | 'xl'
        font: 'draw' | 'mono' | 'sans' | 'serif'
        align: 'end' | 'middle' | 'start'
        opacity: '0.1' | '0.25' | '0.5' | '0.75' | '1'
        text: string
        scale: number
        autoSize: boolean
      }
      type: 'text'
      rotation: number
      index: string
      parentId: import('@tldraw/tlschema').TLParentId
      isLocked: boolean
      id: import('@tldraw/tlstore').ID<TLTextShape>
      typeName: 'shape'
    }
  | undefined
References
onDoubleClickEdge
Public Property
Signature
onDoubleClickEdge: (shape: TLTextShape) =>
  | {
      id: import('@tldraw/tlstore').ID<TLTextShape>
      type: 'text'
      props: {
        autoSize: boolean
        scale?: undefined
      }
    }
  | {
      id: import('@tldraw/tlstore').ID<TLTextShape>
      type: 'text'
      props: {
        scale: number
        autoSize?: undefined
      }
    }
  | undefined
References
onEditEnd
Public Property
Signature
onEditEnd: OnEditEndHandler<TLTextShape>
References
onResize
Public Property
Signature
onResize: OnResizeHandler<TLTextShape>
References
type
Public Static Property
Signature
static type: string
Methods
defaultProps()
Public Method
Parameters
None
Returns
TLTextShape['props']
References
getBounds()
Public Method
Parameters
| Name | Description | 
|---|---|
| 
 |  | 
Returns
Box2d
References
getCenter()
Public Method
Parameters
| Name | Description | 
|---|---|
| 
 |  | 
Returns
Vec2d
References
getMinDimensions()
Public Method
Parameters
| Name | Description | 
|---|---|
| 
 |  | 
Returns
{
  height: number
  width: number
}
References
getOutline()
Public Method
Parameters
| Name | Description | 
|---|---|
| 
 |  | 
Returns
Vec2d[]
References
indicator()
Public Method
Parameters
| Name | Description | 
|---|---|
| 
 |  | 
Returns
JSX.Element
References
render()
Public Method
Parameters
| Name | Description | 
|---|---|
| 
 |  | 
Returns
JSX.Element
References
toSvg()
Public Method
Parameters
| Name | Description | 
|---|---|
| 
 |  | 
| 
 |  | 
| 
 |  | 
Returns
SVGGElement
References
TLTextShape, TLExportColors, SVGGElement