Options for drawBlock

interface DrawBlockOptions {
    alignment?: Placement2D;
    containerSize?: Partial<Size2D>;
    drawFn?: ((text, x, y, maxWidth?) => void);
    origin?: Placement2D;
    textAlignment?: Placement1D;
}

Hierarchy (view full)

Properties

alignment?: Placement2D

How to fit the content to be drawn inside its container

Default

Placement2D.TopLeft
containerSize?: Partial<Size2D>

The size of the container where the content will be drawn

Default

{width: 0, height: 0}
drawFn?: ((text, x, y, maxWidth?) => void)

Function called to draw the text on the canvas.

By default, it is ctx.fillText.

Provided in case you want to, for example, draw an outline in a bigger font for each line.

Type declaration

    • (text, x, y, maxWidth?): void
    • Function called to draw the text on the canvas.

      By default, it is ctx.fillText.

      Provided in case you want to, for example, draw an outline in a bigger font for each line.

      Parameters

      • text: string
      • x: number
      • y: number
      • Optional maxWidth: number

      Returns void

origin?: Placement2D

Set the origin of the content inside its container

Default

Placement2D.TopLeft
textAlignment?: Placement1D

Alignment of the text within the block

Default

Placement1D.Left

Generated using TypeDoc