@mocanvas/mocanvas · class
declare class TextShapeUtil extends ShapeUtil<TextShape, TextShapeUtilDisplayValues>This one ships without a description. The signature above is read from the package, and the guides cover the area it belongs to.
Methods · 14
canEdit(_shape: TextShape): booleancomponent(shape: TextShape): ReactNodegetDefaultProps(): TextShapePropsgetFontFaces(shape: TextShape): TLFontFace[]A text shape is nothing but a label, so it always needs its family's faces.
getGeometry(shape: TextShape): Geometry2dgetIndicatorPath(shape: TextShape): Path2DgetRenderStyle(shape: TextShape): StyleWords | nullA texture of the rasterized label, so the GPU draws the text instead of the
DOM. The shape being edited (and any environment without a canvas) keeps
the DOM path; fill is the text colour so the level-of-detail quad the
engine draws below a few pixels still looks right.
getText(shape: TextShape): stringisAspectRatioLocked(_shape: TextShape): booleanneedsOverlay(shape: TextShape): booleanThe DOM label stands in while editing and until the texture is ready.
onBeforeCreate(next: TextShape): TextShape | voidAuto-sized text keeps w in sync with its measured width.
onBeforeUpdate(prev: TextShape, next: TextShape): TextShape | voidonEditEnd(shape: TextShape): voidA text shape left empty after editing is removed.
onResize(shape: TextShape, info: ResizeInfo<TextShape>): Partial<TextShape>Resizing a text shape changes its wrap width and turns auto-size off.
Properties · 5
static migrations: _mocanvas_editor.PropsMigrationsstatic options: TextShapeOptionsreadonly options: TextShapeOptionsstatic props: _mocanvas_editor.RecordProps<TextShape>static type: "text"mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.