Class LayoutManager

Implements a layout manager that runs a given layout after any changes to the graph:

const layoutManager = new LayoutManager(graph);
layoutManager.getLayout = (cell, eventName) => {
return layout;
};

See getLayout for a description of the possible eventNames.

Fires between begin- and endUpdate after all cells have been layouted in layoutCells. The cells property contains all cells that have been passed to layoutCells.

Hierarchy (view full)

Constructors

Properties

bubbling: boolean = true

Specifies if the layout should bubble along the cell hierarchy.

true
enabled: boolean = true

Specifies if event handling is enabled.

true
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.

moveHandler: ((...args: any[]) => any)

Holds the function that handles the move event.

resizeHandler: ((...args: any[]) => any)

Holds the function that handles the resize event.

undoHandler: ((...args: any[]) => any)

Holds the function that handles the endUpdate event.

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

  • 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

  • Executes all layouts which have been scheduled during the changes.

    Parameters

    • change: any

      mxChildChange|mxTerminalChange|mxVisibleChange|...

    Returns Cell[]

  • Returns true if the given cell has a layout. This implementation invokes with Event#LAYOUT_CELLS as the eventName. Override this if creating layouts in is expensive and return true if will return a layout for the given cell for Event#BEGIN_UPDATE or Event#END_UPDATE.

    Parameters

    Returns boolean

  • Returns true if a layout should bubble, that is, if the parent layout should be executed whenever a cell layout (layout of the children of a cell) has been executed. This implementation returns bubbling.

    Returns boolean

  • Executes all layouts which have been scheduled during the changes.

    Parameters

    • cells: Cell[]
    • bubble: boolean = false

    Returns void

  • Enables or disables event handling. This implementation updates enabled.

    Parameters

    • enabled: boolean

      Boolean that specifies the new enabled state.

    Returns void