ArrowShapeUtil
Table of contents
- migrations
- props
- type
- canBeLaidOut
- canCrop
- canEdit
- canEditInReadOnly
- canResize
- canScroll
- canSnap
- editor
- hideResizeHandles
- hideRotateHandle
- hideSelectionBoundsBg
- hideSelectionBoundsFg
- isAspectRatioLocked
- onBeforeCreate
- onBeforeUpdate
- onChildrenChange
- onClick
- onDoubleClick
- onDoubleClickEdge
- onDoubleClickHandle
- onDragShapesOut
- onDragShapesOver
- onDropShapesOver
- onEditEnd
- onHandleDrag
- onResize
- onResizeEnd
- onResizeStart
- onRotate
- onRotateEnd
- onRotateStart
- onTranslate
- onTranslateEnd
- onTranslateStart
- Properties
- Methods
Extends ShapeUtil<TLArrowShape>.
class ArrowShapeUtil extends ShapeUtil<TLArrowShape> {}
ShapeUtilConstructs a new instance of the ShapeUtil class
| Name | Description |
|---|---|
| |
Properties
static migrations: import('@tldraw/editor').MigrationSequence
static props: import('@tldraw/editor').RecordProps<TLArrowShape>
static type: 'arrow'
canBeLaidOut: TLShapeUtilFlag<TLArrowShape>
ShapeUtilWhether the shape can be cropped.
canCrop: TLShapeUtilFlag<Shape>
canEdit: () => boolean
ShapeUtilWhether the shape can be edited in read-only mode.
canEditInReadOnly: TLShapeUtilFlag<Shape>
ShapeUtilWhether the shape can be resized.
canResize: TLShapeUtilFlag<Shape>
ShapeUtilWhether the shape can be scrolled while editing.
canScroll: TLShapeUtilFlag<Shape>
canSnap: () => boolean
ShapeUtileditor: Editor
hideResizeHandles: TLShapeUtilFlag<TLArrowShape>
hideRotateHandle: TLShapeUtilFlag<TLArrowShape>
hideSelectionBoundsBg: TLShapeUtilFlag<TLArrowShape>
hideSelectionBoundsFg: TLShapeUtilFlag<TLArrowShape>
ShapeUtilWhether the shape's aspect ratio is locked.
isAspectRatioLocked: TLShapeUtilFlag<Shape>
ShapeUtilA callback called just before a shape is created. This method provides a last chance to modify the created shape.
onBeforeCreate?: TLOnBeforeCreateHandler<Shape>
onBeforeCreate = (next) => {
return { ...next, x: next.x + 1 }
}
| Name | Description |
|---|---|
| The next shape. |
ShapeUtilA callback called just before a shape is updated. This method provides a last chance to modify the updated shape.
onBeforeUpdate?: TLOnBeforeUpdateHandler<Shape>
onBeforeUpdate = (prev, next) => {
if (prev.x === next.x) {
return { ...next, x: next.x + 1 }
}
}
| Name | Description |
|---|---|
| The previous shape. |
| The next shape. |
ShapeUtilA callback called when a shape's children change.
onChildrenChange?: TLOnChildrenChangeHandler<Shape>
| Name | Description |
|---|---|
| The shape. |
ShapeUtilA callback called when a shape is clicked.
onClick?: TLOnClickHandler<Shape>
| Name | Description |
|---|---|
| The shape. |
ShapeUtilA callback called when a shape is double clicked.
onDoubleClick?: TLOnDoubleClickHandler<Shape>
| Name | Description |
|---|---|
| The shape. |
ShapeUtilA callback called when a shape's edge is double clicked.
onDoubleClickEdge?: TLOnDoubleClickHandler<Shape>
| Name | Description |
|---|---|
| The shape. |
onDoubleClickHandle: (
shape: TLArrowShape,
handle: TLHandle
) => TLShapePartial<TLArrowShape> | void
ShapeUtilA callback called when some other shapes are dragged out of this one.
onDragShapesOut?: TLOnDragHandler<Shape>
| Name | Description |
|---|---|
| The shape. |
| The shapes that are being dragged out. |
ShapeUtilA callback called when some other shapes are dragged over this one.
onDragShapesOver?: TLOnDragHandler<Shape>
onDragShapesOver = (shape, shapes) => {
this.editor.reparentShapes(shapes, shape.id)
}
| Name | Description |
|---|---|
| The shape. |
| The shapes that are being dragged over this one. |
ShapeUtilA callback called when some other shapes are dropped over this one.
onDropShapesOver?: TLOnDragHandler<Shape>
| Name | Description |
|---|---|
| The shape. |
| The shapes that are being dropped over this one. |
onEditEnd: TLOnEditEndHandler<TLArrowShape>
onHandleDrag: TLOnHandleDragHandler<TLArrowShape>
onResize: TLOnResizeHandler<TLArrowShape>
ShapeUtilA callback called when a shape finishes resizing.
onResizeEnd?: TLOnResizeEndHandler<Shape>
| Name | Description |
|---|---|
| The shape at the start of the resize. |
| The current shape. |
ShapeUtilA callback called when a shape starts being resized.
onResizeStart?: TLOnResizeStartHandler<Shape>
| Name | Description |
|---|---|
| The shape. |
ShapeUtilA callback called when a shape changes from a rotation.
onRotate?: TLOnRotateHandler<Shape>
| Name | Description |
|---|---|
| The shape at the start of the rotation. |
| The current shape. |
ShapeUtilA callback called when a shape finishes rotating.
onRotateEnd?: TLOnRotateEndHandler<Shape>
| Name | Description |
|---|---|
| The shape at the start of the rotation. |
| The current shape. |
ShapeUtilA callback called when a shape starts being rotated.
onRotateStart?: TLOnRotateStartHandler<Shape>
| Name | Description |
|---|---|
| The shape. |
onTranslate?: TLOnTranslateHandler<TLArrowShape>
ShapeUtilA callback called when a shape finishes translating.
onTranslateEnd?: TLOnTranslateEndHandler<Shape>
| Name | Description |
|---|---|
| The shape at the start of the translation. |
| The current shape. |
onTranslateStart: TLOnTranslateStartHandler<TLArrowShape>
Methods
canBind({ toShapeType }: TLShapeUtilCanBindOpts<TLArrowShape>): boolean
| Name | Description |
|---|---|
| |
boolean
ShapeUtilGet whether the shape can receive children of a given type.
canDropShapes(shape: Shape, shapes: TLShape[]): boolean
| Name | Description |
|---|---|
| The shape type. |
| The shapes that are being dropped. |
boolean
ShapeUtilGet whether the shape can receive children of a given type.
canReceiveNewChildrenOfType(shape: Shape, type: TLShape['type']): boolean
| Name | Description |
|---|---|
| |
| The shape type. |
boolean
component(shape: TLArrowShape): import('react/jsx-runtime').JSX.Element | null
| Name | Description |
|---|---|
| |
import('react/jsx-runtime').JSX.Element | null
ShapeUtilGet the geometry to use when snapping to this this shape in translate/resize operations. See BoundsSnapGeometry for details.
getBoundsSnapGeometry(shape: Shape): BoundsSnapGeometry
| Name | Description |
|---|---|
| |
BoundsSnapGeometry
getCanvasSvgDefs(): TLShapeUtilCanvasSvgDef[]
getDefaultProps(): TLArrowShape['props']
getGeometry(shape: TLArrowShape): Group2d
| Name | Description |
|---|---|
| |
Group2d
getHandles(shape: TLArrowShape): TLHandle[]
| Name | Description |
|---|---|
| |
TLHandle[]
ShapeUtilGet the geometry to use when snapping handles to this shape. See HandleSnapGeometry for details.
getHandleSnapGeometry(shape: Shape): HandleSnapGeometry
| Name | Description |
|---|---|
| |
HandleSnapGeometry
getInterpolatedProps(
startShape: TLArrowShape,
endShape: TLArrowShape,
progress: number
): TLArrowShapeProps
| Name | Description |
|---|---|
| |
| |
| |
TLArrowShapeProps
indicator(shape: TLArrowShape): import('react/jsx-runtime').JSX.Element | null
| Name | Description |
|---|---|
| |
import('react/jsx-runtime').JSX.Element | null
ShapeUtilGet the shape's background layer as an SVG object.
toBackgroundSvg?(
shape: Shape,
ctx: SvgExportContext
): null | Promise<null | ReactElement> | ReactElement
| Name | Description |
|---|---|
| The shape. |
| ctx - The export context for the SVG - used for adding e.g. <def>s |
null | Promise<null | ReactElement> | ReactElement
An SVG element.
toSvg(
shape: TLArrowShape,
ctx: SvgExportContext
): import('react/jsx-runtime').JSX.Element
| Name | Description |
|---|---|
| |
| |
import('react/jsx-runtime').JSX.Element

