@maxgraph/core
    Preparing search index...

    Class CellRenderer

    Renders cells into a document object model. The is a global map of shape names, constructor pairs that is used in all instances. You can get a list of all available shape names using the following code.

    In general the cell renderer is in charge of creating, redrawing and destroying the shape and label associated with a cell state, as well as some other graphical objects, namely controls and overlays. The shape hierarchy in the display (i.e. the hierarchy in which the DOM nodes appear in the document) does not reflect the cell hierarchy. The shapes are a (flat) sequence of shapes and labels inside the draw pane of the graph view, with some exceptions, namely the HTML labels being placed directly inside the graph container for certain browsers.

    Index

    Constructors

    Properties

    antiAlias: boolean = true

    Antialiasing option for new shapes.

    true.
    
    defaultEdgeShape: typeof Shape = ConnectorShape

    Defines the default shape for edges.

    defaultTextShape: typeof TextShape = TextShape

    Defines the default shape for labels.

    TextShape.

    defaultVertexShape: typeof RectangleShape = RectangleShape

    Defines the default shape for vertices.

    forceControlClickHandler: boolean = false

    Specifies if the enabled state of the graph should be ignored in the control click handler (to allow folding in disabled graphs).

    false.
    
    legacyControlPosition: boolean = true

    Specifies if the folding icon should ignore the horizontal orientation of a swimlane.

    true.
    
    legacySpacing: boolean = true

    Specifies if spacing and label position should be ignored if overflow is fill or width.

    true for backwards compatibility.
    
    minSvgStrokeWidth: number = 1

    Minimum stroke width for SVG output.

    defaultShapes: { [key: string]: typeof Shape } = {}

    Static array that contains the globally registered shapes which are known to all instances of this class. For adding new shapes you should use the static CellRenderer#registerShape function.

    Built-in shapes: arrow, rectangle, ellipse, rhombus, image, line, label, cylinder, swimlane, connector, actor and cloud.

    Methods

    • Initializes the given control and returns the corresponding DOM node.

      Parameters

      • state: CellState

        CellState for which the control should be initialized.

      • control: Shape

        Shape to be initialized.

      • handleEvents: boolean

        Boolean indicating if mousedown and mousemove should fire events via the graph.

      • clickHandler: EventListener

        Optional function to implement clicks on the control.

      Returns null | Element

    • Inserts the given CellState after the given nodes in the DOM.

      Parameters

      • state: CellState

        CellState to be inserted.

      • node: null | HTMLElement | SVGElement

        Node in GraphView.drawPane after which the shapes should be inserted.

      • htmlNode: null | HTMLElement | SVGElement

        Node in the graph container after which the shapes should be inserted that will not go into the GraphView.drawPane (e.g. HTML labels without foreignObjects).

      Returns (null | HTMLElement | SVGElement)[]

    • Returns true if the event is for the label of the given state.

      This implementation always returns true.

      Parameters

      • state: CellState

        CellState whose label fired the event.

      • evt: MouseEvent

        Mouse event which was fired.

      Returns boolean

    • Returns true if the event is for the shape of the given state.

      This implementation always returns true.

      Parameters

      • state: CellState

        CellState whose shape fired the event.

      • evt: MouseEvent

        Mouse event which was fired.

      Returns boolean

    • Replaces any reserved words used for attributes, eg. inherit, indicated or swimlane for colors in the shape for the given state. This implementation resolves these keywords on the fill, stroke and gradient color keys.

      Parameters

      Returns void

    • Updates the bounds or points and scale of the shapes for the given cell state. This is called in mxGraphView.validatePoints as the last step of updating all cells.

      Parameters

      • state: CellState

        CellState for which the shapes should be updated.

      • force: boolean = false

        Optional boolean that specifies if the cell should be reconfiured and redrawn without any additional checks.

      • rendering: boolean = true

        Optional boolean that specifies if the cell should actually be drawn into the DOM. If this is false then redraw and/or reconfigure will not be called on the shape.

      Returns void

    • Redraws the shape for the given cell state.

      Parameters

      • state: CellState

        CellState whose label should be redrawn.

      • force: boolean = false
      • rendering: boolean = true

      Returns boolean

    • Resolves special keywords 'inherit', 'indicated' and 'swimlane' and sets the respective color on the shape.

      Parameters

      Returns void

    • Registers the given constructor under the specified key in this instance of the renderer.

      Parameters

      • key: string

        the shape name.

      • shape: typeof Shape

        constructor of the Shape subclass.

      Returns void

      CellRenderer.registerShape(Constants.SHAPE_RECTANGLE, RectangleShape);