Skip to content

TextNode

hhh edited this page Jan 28, 2023 · 6 revisions

TextNode

/**
 * Type of options of {@link TextNode}.
 */
type TextNodeOptions<Events extends CanvasNodeEvents> = (CanvasNodeOptions<Events> & Partial<{
    /**
     * The text content.
     * @default ''
     */
    content: string;
    /**
     * Whether the text should be rendered
     * from left to right.
     * (This only affects text align.)
     * @default true
     */
    ltr: boolean;
}>);

/**
 * Class of text nodes.
 */
class TextNode<Events extends CanvasNodeEvents = CanvasNodeEvents> extends CanvasNode<Events> {

    /**
     * Constructor of {@link TextNode}.
     */
    constructor(options?: TextNodeOptions<Events>);

    /**
     * @override CanvasNode.tag
     */
    readonly tag: string;

    /**
     * The text content.
     * @default ''
     */
    content: string;

    /**
     * Whether the text should be rendered
     * from left to right.
     * (This only affects text align.)
     * @default true
     */
    ltr: boolean;

    /**
     * @override CanvasNode.renderSelf
     */
    protected renderSelf(renderer: Renderer): void;

    /**
     * @override ShapeNode.getRecordOptions
     */
    getRecordOptions(): NodeRecordOptions;
}

Documentation of canvasom

Clone this wiki locally