TextShapeUtil
Table of contents
Public class
Signature
class TextShapeUtil extends ShapeUtil<TLTextShape> {}
References
Source
packages/tldraw/src/lib/shapes/text/TextShapeUtil.tsx
Properties
canEdit
Public property
Signature
canEdit: () => boolean
isAspectRatioLocked
Public property
Signature
isAspectRatioLocked: TLShapeUtilFlag<TLTextShape>
References
migrations
Public static property
Signature
static migrations: import('@tldraw/editor').Migrations
References
onBeforeCreate
Public property
Signature
onBeforeCreate: (shape: TLTextShape) =>
| {
x: number
y: number
type: 'text'
rotation: number
index: string
parentId: import('@tldraw/editor').TLParentId
isLocked: boolean
opacity: number
props: {
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-legacy'
| 'end'
| 'middle-legacy'
| 'middle'
| 'start-legacy'
| 'start'
w: number
text: string
scale: number
autoSize: boolean
}
meta: import('@tldraw/editor').JsonObject
id: import('@tldraw/editor').TLShapeId
typeName: 'shape'
}
| undefined
References
TLTextShape, TLParentId, TLShapeId
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-legacy'
| 'end'
| 'middle-legacy'
| 'middle'
| 'start-legacy'
| 'start'
text: string
scale: number
autoSize: boolean
}
type: 'text'
rotation: number
index: string
parentId: import('@tldraw/editor').TLParentId
isLocked: boolean
opacity: number
meta: import('@tldraw/editor').JsonObject
id: import('@tldraw/editor').TLShapeId
typeName: 'shape'
}
| undefined
References
TLTextShape, TLParentId, TLShapeId
onDoubleClickEdge
Public property
Signature
onDoubleClickEdge: (shape: TLTextShape) =>
| {
id: import('@tldraw/editor').TLShapeId
type: 'text'
props: {
autoSize: boolean
scale?: undefined
}
}
| {
id: import('@tldraw/editor').TLShapeId
type: 'text'
props: {
scale: number
autoSize?: undefined
}
}
| undefined
References
onEditEnd
Public property
Signature
onEditEnd: TLOnEditEndHandler<TLTextShape>
References
TLOnEditEndHandler, TLTextShape
onResize
Public property
Signature
onResize: TLOnResizeHandler<TLTextShape>
References
TLOnResizeHandler, TLTextShape
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'
| 'yellow'
>
size: import('@tldraw/editor').EnumStyleProp<'l' | 'm' | 's' | 'xl'>
font: import('@tldraw/editor').EnumStyleProp<
'draw' | 'mono' | 'sans' | 'serif'
>
align: import('@tldraw/editor').EnumStyleProp<
| 'end-legacy'
| 'end'
| 'middle-legacy'
| 'middle'
| 'start-legacy'
| 'start'
>
w: import('@tldraw/editor').Validator<number>
text: import('@tldraw/editor').Validator<string>
scale: import('@tldraw/editor').Validator<number>
autoSize: import('@tldraw/editor').Validator<boolean>
}
References
type
Public static property
Signature
static type: 'text'
Methods
component()
Public method
Signature
component(shape: TLTextShape): import('react/jsx-runtime').JSX.Element
Parameters
Name | Description |
---|---|
|
|
Returns
import('react/jsx-runtime').JSX.Element
References
getDefaultProps()
Public method
Signature
getDefaultProps(): TLTextShape['props']
References
getGeometry()
Public method
Signature
getGeometry(shape: TLTextShape): Rectangle2d
Parameters
Name | Description |
---|---|
|
|
Returns
Rectangle2d
References
getMinDimensions()
Public method
Signature
getMinDimensions(shape: TLTextShape): {
height: number
width: number
}
Parameters
Name | Description |
---|---|
|
|
Returns
{
height: number
width: number
}
References
indicator()
Public method
Signature
indicator(shape: TLTextShape): import('react/jsx-runtime').JSX.Element | null
Parameters
Name | Description |
---|---|
|
|
Returns
import('react/jsx-runtime').JSX.Element | null
References
toSvg()
Public method
Signature
toSvg(shape: TLTextShape, ctx: SvgExportContext): SVGGElement
Parameters
Name | Description |
---|---|
|
|
|
|
Returns
SVGGElement
References