@maxgraph/core
    Preparing search index...

    Class GraphView

    GraphView

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    allowEval: boolean = false

    Specifies if string values in cell styles should be evaluated using eval.

    This will only be used if the string values can't be mapped to objects using StyleRegistry when resolving CellStateStyle.edgeStyle and CellStateStyle.perimeter.

    WARNING: Enabling this switch carries a possible security risk.

    false
    
    backgroundImage: null | ImageShape = null
    backgroundPageShape: null | Shape = null
    backgroundPane: HTMLElement | SVGElement
    canvas: HTMLElement | SVGElement
    captureDocumentGesture: boolean = true

    Specifies if a gesture should be captured when it goes outside of the graph container. Default is true.

    currentRoot: null | Cell = null

    Cell that acts as the root of the displayed cell hierarchy.

    decoratorPane: HTMLElement | SVGElement
    doneResource: string = ...

    Specifies the resource key for the status message after a long operation. If the resource for this key does not exist then the value is used as the status message.

    'done'
    
    drawPane: HTMLElement | SVGElement
    EMPTY_POINT: Point = ...
    endHandler: null | MouseEventListener = null
    eventListeners: EventListenerObject[] = []

    Holds the event names and associated listeners in an array. The array contains the event name followed by the respective listener for each registered listener.

    eventsEnabled: boolean = true

    Specifies if events can be fired. Default is true.

    eventSource: null | EventTarget = null

    Optional source for events. Default is null.

    graph: Graph

    Reference to the enclosing graph.

    graphBounds: Rectangle = ...
    lastForegroundHtmlNode: null | HTMLElement | SVGElement = null

    During validation, this contains the last edge HTML DOM node that was processed.

    lastForegroundNode: null | HTMLElement | SVGElement = null

    During validation, this contains the last edge's DOM node that was processed.

    lastHtmlNode: null | HTMLElement | SVGElement = null

    During validation, this contains the last HTML DOM node that was processed.

    lastNode: null | HTMLElement | SVGElement = null

    During validation, this contains the last DOM node that was processed.

    moveHandler: null | MouseEventListener = null
    overlayPane: HTMLElement | SVGElement
    rendering: boolean = true

    Specifies if shapes should be created, updated and destroyed using the methods of cellRenderer in graph. Default is true.

    scale: number = 1
    states: Dictionary<Cell, CellState> = ...
    translate: Point = ...

    Point that specifies the current translation. Default is a new empty Point.

    updateStyle: boolean = false

    Specifies if the style should be updated in each validation step. If this is false then the style is only updated if the state is created or if the style of the cell was changed. Default is false.

    updatingDocumentResource: string = ...

    Specifies the resource key for the status message while the document is being updated. If the resource for this key does not exist then the value is used as the status message.

    'updatingSelection'
    

    Methods

    • Binds the specified function to the given event name. If no event name is given, then the listener is registered for all events.

      The parameters of the listener are the sender and an EventObject.

      Parameters

      • name: string
      • funct: Function

      Returns void

    • Removes the state of the given cell and all descendants if the given cell is not the current root.

      Parameters

      • Optionalcell: null | Cell

        Optional Cell for which the state should be removed. Default is the root of the model.

      • force: boolean = false

        Boolean indicating if the current root should be ignored for recursion.

      • recurse: boolean = true

      Returns void

    • Function: createHtml

      Creates the DOM nodes for the HTML display.

      Returns void

    • Function: createHtmlPane

      Creates and returns a drawing pane in HTML (DIV).

      Parameters

      • width: string
      • height: string

      Returns HTMLElement

    • Creates and returns the DOM nodes for the SVG display.

      Returns void

    • Dispatches the given event to the listeners which are registered for the event. The sender argument is optional. The current execution scope ("this") is used for the listener invocation (see Utils#bind).

      Example:

      fireEvent(new mxEventObject("eventName", key1, val1, .., keyN, valN))
      

      Parameters

      • evt: EventObject

        EventObject that represents the event.

      • sender: null | EventTarget = null

        Optional sender to be passed to the listener. Default value is the return value of .

      Returns void

    • Returns the DOM node that represents the background layer.

      Returns HTMLElement | SVGElement

    • Returns the bounding box of the shape and the label for the given CellState and its children if recurse is true.

      Parameters

      • state: null | CellState = null

        CellState whose bounding box should be returned.

      • recurse: boolean = true

        Optional boolean indicating if the children should be included. Default is true.

      Returns null | Rectangle

    • Returns the DOM node that contains the background-, draw- and overlay- and decoratorpanes.

      Returns HTMLElement | SVGElement

    • Returns the mxCellStates for the given array of Cell. The array contains all states that are not null, that is, the returned array may have less elements than the given array. If no argument is given, then this returns states.

      Parameters

      • cells: null | Cell[] = null

      Returns CellState[]

    • Returns the DOM node that represents the topmost drawing layer.

      Returns HTMLElement | SVGElement

    • Returns the DOM node that represents the main drawing layer.

      Returns HTMLElement | SVGElement

    • Returns the floating terminal point for the given edge, start and end state, where start is the source if source is true.

      Parameters

      • edge: CellState

        CellState whose terminal point should be returned.

      • start: CellState

        CellState for the terminal on "this" side of the edge.

      • end: null | CellState

        CellState for the terminal on the other side of the edge.

      • source: boolean

        Boolean indicating if start is the source terminal state.

      Returns null | Point

    • Returns the nearest point in the list of absolute points or the center of the opposite terminal.

      Parameters

      • edge: CellState

        CellState that represents the edge.

      • opposite: null | CellState

        CellState that represents the opposite terminal.

      • source: boolean = false

        Boolean indicating if the next point for the source or target should be returned.

      Returns Point

    • Returns the DOM node that represents the layer above the drawing layer.

      Returns HTMLElement | SVGElement

    • Returns the perimeter bounds for the given terminal, edge pair as an Rectangle.

      If you have a model where each terminal has a relative child that should act as the graphical endpoint for a connection from/to the terminal, then this method can be replaced as follows:

      Parameters

      • terminal: CellState

        CellState that represents the terminal.

      • border: number = 0

        Number that adds a border between the shape and the perimeter.

      Returns Rectangle

      var oldGetPerimeterBounds = getPerimeterBounds;
      getPerimeterBounds(terminal, edge, isSource)
      {
      var model = this.graph.getDataModel();
      var childCount = model.getChildCount(terminal.cell);

      if (childCount > 0)
      {
      var child = model.getChildAt(terminal.cell, 0);
      var geo = model.getGeometry(child);

      if (geo != null &&
      geo.relative)
      {
      var state = this.getState(child);

      if (state != null)
      {
      terminal = state;
      }
      }
      }

      return oldGetPerimeterBounds.apply(this, arguments);
      };
    • Returns an Point that defines the location of the intersection point between the perimeter and the line between the center of the shape and the given point.

      Parameters

      • terminal: CellState

        CellState for the source or target terminal.

      • next: Point

        Point that lies outside the given terminal.

      • orthogonal: boolean

        Boolean that specifies if the orthogonal projection onto the perimeter should be returned. If this is false then the intersection of the perimeter and the line between the next and the center point is returned.

      • border: number = 0

        Optional border between the perimeter and the shape.

      Returns null | Point

    • Gets the relative point that describes the given, absolute label position for the given edge state.

      Parameters

      • edgeState: CellState
      • x: number

        Specifies the x-coordinate of the absolute label location.

      • y: number

        Specifies the y-coordinate of the absolute label location.

      Returns Point

    • Returns the CellState for the given cell. If create is true, then the state is created if it does not yet exist.

      Parameters

      • cell: Cell

        mxCell for which the CellState should be returned.

      • create: boolean = false

        Optional boolean indicating if a new state should be created if it does not yet exist. Default is false.

      Returns null | CellState

    • Returns the nearest ancestor terminal that is visible. The edge appears to be connected to this terminal on the display. The result of this method is cached in CellState.getVisibleTerminalState.

      Parameters

      • edge: Cell

        mxCell whose visible terminal should be returned.

      • source: boolean

        Boolean that specifies if the source or target terminal should be returned.

      Returns null | Cell

    • Initializes the graph event dispatch loop for the specified container and invokes create to create the required DOM nodes for the display.

      Returns void

    • Installs the required listeners in the container.

      Returns void

    • Invalidates the state of the given cell, all its descendants and connected edges.

      Parameters

      • cell: null | Cell = null

        Optional Cell to be invalidated. Default is the root of the model.

      • recurse: boolean = true
      • includeEdges: boolean = true

      Returns void

    • Returns true if the event origin is one of the drawing panes or containers of the view.

      Parameters

      • evt: MouseEvent

      Returns any

    • Parameters

      • evt: MouseEvent | TouchEvent

      Returns boolean

    • Updates the bounds and redraws the background image.

      Example:

      If the background image should not be scaled, this can be replaced with the following.

      Parameters

      • backgroundImage: ImageShape

        mxImageShape that represents the background image.

      • bg: ImageBox

        mxImage that specifies the image and its dimensions.

      Returns void

      redrawBackground(backgroundImage, bg)
      {
      backgroundImage.bounds.x = this.translate.x;
      backgroundImage.bounds.y = this.translate.y;
      backgroundImage.bounds.width = bg.width;
      backgroundImage.bounds.height = bg.height;

      backgroundImage.redraw();
      };
    • Resets the current validation state.

      Returns void

    • Revalidates the complete view with all cell states.

      Returns void

    • Sets the scale and translation and fires a scale and translate event before calling revalidate followed by graph.sizeDidChange.

      Parameters

      • scale: number

        Decimal value that specifies the new scale (1 is 100%).

      • dx: number

        X-coordinate of the translation.

      • dy: number

        Y-coordinate of the translation.

      Returns void

    • Sets and returns the current root and fires an undo event before calling graph.sizeDidChange.

      Parameters

      • root: null | Cell

        mxCell that specifies the root of the displayed cell hierarchy.

      Returns null | Cell

    • Sets the translation and fires a translate event before calling revalidate followed by Graph.sizeDidChange. The translation is the negative of the origin.

      Parameters

      • dx: number

        X-coordinate of the translation.

      • dy: number

        Y-coordinate of the translation.

      Returns void

    • Invoked when a state has been processed in validatePoints. This is used to update the order of the DOM nodes of the shape.

      Parameters

      Returns void

    • Updates the bounds of the given cell state to reflect the bounds of the stencil if it has a fixed aspect and returns the previous bounds as an Rectangle if the bounds have been modified or null otherwise.

      Parameters

      Returns null | Rectangle

    • Updates the style of the container after installing the SVG DOM elements.

      Parameters

      • container: HTMLElement

      Returns void

    • Updates CellState.absoluteOffset for the given state. The absolute offset is normally used for the position of the edge label. Is is calculated from the geometry as an absolute offset from the center between the two endpoints if the geometry is absolute, or as the relative distance between the center along the line and the absolute orthogonal distance if the geometry is relative.

      Parameters

      Returns void

    • Updates the absolute terminal point in the given state for the given start and end state, where start is the source if source is true.

      Parameters

      • edge: CellState

        CellState whose terminal point should be updated.

      • start: CellState

        CellState for the terminal on "this" side of the edge.

      • end: null | CellState

        CellState for the terminal on the other side of the edge.

      • source: boolean

        Boolean indicating if start is the source terminal state.

      Returns void

    • Function: updateHtmlCanvasSize

      Updates the size of the HTML canvas.

      Parameters

      • width: number
      • height: number

      Returns void

    • Updates the absoluteOffset of the given vertex cell state. This takes into account the label position styles.

      Parameters

      Returns void

    • Validates the background image.

      Returns void

    • Validates the background page.

      Returns void

    • Recursively creates the cell state for the given cell if visible is true and the given cell is visible. If the cell is not visible but the state exists then it is removed using removeState.

      Parameters

      • cell: Cell

        mxCell whose CellState should be created.

      • visible: boolean = true

        Optional boolean indicating if the cell should be visible. Default is true.

      Returns Cell

    • Validates and repaints the CellState for the given Cell.

      Parameters

      • cell: null | Cell

        mxCell whose CellState should be validated.

      • recurse: boolean = true

        Optional boolean indicating if the children of the cell should be validated. Default is true.

      Returns null | CellState