Class TextBlock

TextBlock represents a block of text used across all text-based stencils and connector labels.

Hierarchy

  • TextBlock

Constructors

  • Creates a text block

    Parameters

    • Optional text: string

      initial text

    Returns TextBlock

Properties

offsetX: number = 0

Text block's horizontal offset from the automatically calculated position.

offsetY: number = 0

Text block's vertical offset from the automatically calculated position.

Accessors

  • get boundingBox(): DOMRect
  • Returns the bounding box where text should fit and/or be anchored.

    Returns DOMRect

  • set boundingBox(value): void
  • Sets the bounding box where text should fit and/or be anchored.

    Parameters

    • value: DOMRect

    Returns void

  • get color(): string
  • Returns the text color.

    Returns string

  • set color(value): void
  • Sets the text color.

    Parameters

    • value: string

    Returns void

  • get fontFamily(): string
  • Returns the text's font family.

    Returns string

  • set fontFamily(value): void
  • Sets the text's font family.

    Parameters

    • value: string

    Returns void

  • get fontSize(): FontSize
  • Returns the text's font size.

    Returns FontSize

  • set fontSize(value): void
  • Sets the text's font size.

    Parameters

    Returns void

  • get labelBackground(): SVGRectElement
  • Returns the background rectangle (behind the text).

    Returns SVGRectElement

  • get text(): string
  • Returns the text block's text

    Returns string

  • set text(value): void
  • Sets the text block's text.

    Parameters

    • value: string

    Returns void

  • get textElement(): SVGTextElement
  • Returns the text block's text element.

    Returns SVGTextElement

  • get textSize(): undefined | DOMRect
  • Returns the size of the rectangle containing the text block's text.

    Returns undefined | DOMRect

Methods

  • Hides the text block content.

    Returns void

  • Hides the text block's dashed outline.

    Returns void

  • Returns true if the text block contains the supplied element.

    Parameters

    • el: EventTarget

      element to test.

    Returns boolean

    true if the element belongs to the text block, false otherwise.

  • Positions the text within the text block.

    Parameters

    Returns void

  • Renders text within the text block according to its settings.

    Returns void

  • Makes the text block content visible.

    Returns void

  • Shows the text block's dashed outline.

    Returns void

Events

onTextSizeChanged?: ((textBlock) => void)

Type declaration

    • (textBlock): void
    • Fired when text size changes.

      Parameters

      Returns void

Generated using TypeDoc