@maxgraph/core
    Preparing search index...

    Class TextShape

    Extends Shape to implement a text shape.

    To change vertical text from "bottom to top" to "top to bottom", the following code can be used:

    TextShape.prototype.verticalTextRotation = 90;
    

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Methods

    Constructors

    • Parameters

      • value: string | HTMLElement | SVGGElement
      • bounds: Rectangle
      • align: AlignValue = ALIGN.CENTER
      • valign: VAlignValue = ALIGN.MIDDLE
      • color: string = 'black'
      • family: string = DEFAULT_FONTFAMILY
      • size: number = DEFAULT_FONTSIZE
      • fontStyle: number = DEFAULT_FONTSTYLE
      • spacing: number = 2
      • spacingTop: number = 0
      • spacingRight: number = 0
      • spacingBottom: number = 0
      • spacingLeft: number = 0
      • horizontal: boolean = true
      • background: string = NONE
      • border: string = NONE
      • wrap: boolean = false
      • clipped: boolean = false
      • overflow: OverflowValue = 'visible'
      • labelPadding: number = 0
      • textDirection: TextDirectionValue = DEFAULT_TEXT_DIRECTION

      Returns TextShape

    Properties

    align: AlignValue
    antiAlias: boolean = true

    Rendering hint for configuring the canvas.

    background: string
    baseSpacingBottom: number = 0

    Specifies the spacing to be added to the bottom spacing. Default is 0. Use the value 1 here to get the same label positions as in mxGraph 1.x.

    baseSpacingLeft: number = 0

    Specifies the spacing to be added to the left spacing. Default is 0.

    baseSpacingRight: number = 0

    Specifies the spacing to be added to the right spacing. Default is 0.

    baseSpacingTop: number = 0

    Specifies the spacing to be added to the top spacing. Default is 0. Use the value 5 here to get the same label positions as in mxGraph 1.x.

    border: string
    boundingBox: null | Rectangle = null

    Contains the bounding box of the shape, that is, the smallest rectangle that includes all pixels of the shape.

    bounds: Rectangle

    Holds the Rectangle that specifies the bounds of this shape.

    cacheEnabled: boolean = true

    Specifies if caching for HTML labels should be enabled. Default is true.

    clipped: boolean
    color: string
    cursor: string = ''
    dialect: null | string = null

    Holds the dialect in which the shape is to be painted. This can be one of the DIALECT constants in Constants.

    direction: DirectionValue = DIRECTION.EAST
    endArrow: string = NONE
    endSize: number = 1
    family: string
    fill: string = NONE
    fillOpacity: number = 100
    flipH: boolean = false
    flipV: boolean = false
    fontStyle: number
    glass: boolean = false
    gradient: string = NONE
    gradientDirection: DirectionValue = DIRECTION.EAST
    horizontal: boolean
    ignoreClippedStringSize: boolean = true

    Specifies if the string size should be measured in if the label is clipped and the label position is center and middle. If this is true, then the bounding box will be set to . Default is true. has precedence over this switch.

    ignoreStringSize: boolean = false

    Specifies if the actual string size should be measured. If disabled the boundingBox will not ignore the actual size of the string, otherwise will be used instead. Default is false.

    image: null | ImageBox = null
    imageSrc: null | string = null
    indicator: null | Shape = null
    indicatorColor: string = NONE
    indicatorDirection: DirectionValue = DIRECTION.EAST
    indicatorGradientColor: string = NONE
    indicatorImageSrc: null | string = null
    indicatorShape: null | typeof Shape = null
    indicatorStrokeColor: string = NONE
    isDashed: boolean = false
    isRounded: boolean = false
    isShadow: boolean = false
    labelPadding: number
    lastValue: null | string | HTMLElement | SVGGElement = null

    Contains the last rendered text value. Used for caching.

    margin: null | Point = null
    minSvgStrokeWidth: number = 1

    Minimum stroke width for SVG output.

    node: SVGGElement

    Holds the outermost DOM node that represents this shape.

    oldGradients: GradientMap = {}
    opacity: number = 100
    originalPointerEvents: null | boolean = null
    outline: boolean = false

    Specifies if the shape should be drawn as an outline. This disables all fill colors and can be used to disable other drawing states that should not be painted for outlines. Default is false. This should be set before calling .

    overflow: OverflowValue
    overlay: null | CellOverlay = null
    pointerEvents: boolean = true

    Specifies if pointer events should be handled. Default is true.

    points: (null | Point)[] = []

    Holds the array of that specify the points of this shape.

    preserveImageAspect: boolean = false

    Switch to preserve image aspect.

    false
    
    replaceLinefeeds: boolean = true

    Specifies if linefeeds in HTML labels should be replaced with BR tags. Default is true.

    rotation: number = 0
    scale: number = 1

    Holds the scale in which the shape is being painted.

    shapePointerEvents: boolean = false

    Specifies if pointer events outside of shape should be handled. Default is false.

    size: number
    spacing: number
    spacingBottom: number
    spacingLeft: number
    spacingRight: number
    spacingTop: number
    startArrow: string = NONE
    startSize: number = 1
    state: null | CellState = null

    Optional reference to the corresponding .

    stencil: null | StencilShape = null

    Holds the StencilShape that defines the shape.

    stencilPointerEvents: boolean = false

    Specifies if pointer events outside of stencils should be handled. Default is false. Set this to true for backwards compatibility with the 1.x branch.

    stroke: string = NONE
    strokeOpacity: number = 100
    strokeWidth: number = 1
    style: null | CellStateStyle = null

    Optional reference to the style of the corresponding .

    svgPointerEvents: string = 'all'

    Specifies if pointer events should be handled. Default is true.

    svgStrokeTolerance: number = 8

    Event-tolerance for SVG strokes (in px). This is only passed to the canvas in createSvgCanvas if pointerEvents is true.

    8
    
    textDirection: TextDirectionValue
    unrotatedBoundingBox: null | Rectangle = null
    useSvgBoundingBox: boolean = true

    Allows to use the SVG bounding box in SVG. Default is false for performance reasons.

    valign: VAlignValue
    value: string | HTMLElement | SVGGElement
    verticalTextRotation: number = -90

    Rotation for vertical text. Default is -90 (bottom to top).

    visible: boolean = true

    Specifies if the shape is visible. Default is true.

    wrap: boolean

    Methods

    • Paints the given points with rounded corners.

      Parameters

      • c: AbstractCanvas2D
      • pts: Point[]
      • rounded: boolean = false
      • arcSize: number
      • close: boolean = false
      • exclude: number[] = []
      • initialMove: boolean = true

      Returns void

    • Creates and returns the DOM node for the shape. This implementation assumes that maxGraph produces SVG elements.

      Returns SVGGElement

    • Adds a transparent rectangle that catches all events.

      Parameters

      • x: number
      • y: number
      • w: number
      • h: number

      Returns SVGRectElement

    • Destroys the shape by removing it from the DOM and releasing the DOM node associated with the shape using Event#release.

      Returns void

    • Used to determine the automatic text direction. Returns Constants#TEXT_DIRECTION_LTR or Constants#TEXT_DIRECTION_RTL depending on the contents of . This is not invoked for HTML, wrapped content or if is a DOM node.

      Returns LTR | RTL

    • Initializes the shape by creaing the DOM node using and adding it into the given container.

      Parameters

      • container: HTMLElement | SVGElement

        DOM node that will contain the shape.

      Returns void

    • Updates the HTML node(s) to reflect the latest bounds and scale.

      Parameters

      • node: HTMLElement | SVGGElement

      Returns void

    • Updates the HTML node(s) to reflect the latest bounds and scale.

      Parameters

      • node: HTMLElement
      • enableWrap: boolean = false

      Returns void