@maxgraph/core
    Preparing search index...

    Class GraphSelectionModel

    Implements the selection model for a graph.

    Here is a listener that handles all removed selection cells.

    graph.getSelectionModel().addListener(InternalEvent.CHANGE, function(sender, evt) {
    const cells = evt.getProperty('added');
    for (const cell of cells) {
    // Handle cell...
    }
    });

    InternalEvent.UNDO

    Fires after the selection was changed in changeSelection. The edit property contains the UndoableEdit which contains the SelectionChange.

    InternalEvent.CHANGE

    Fires after the selection changes by executing an SelectionChange.

    WARN: the event's added and removed properties contain arrays of cells that have been added to or removed from the selection, respectively. The names are inverted due to historic reasons.

    See the SelectionChange class for more details.

    Hierarchy (View Summary)

    Index
    cells: Cell[]
    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'
    
    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: EventTarget | null = null

    Optional source for events.

    null
    
    singleSelection: boolean = false

    Specifies if only one selected item at a time is allowed.

    false.
    
    updatingSelectionResource: string = ...

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

    'updatingSelection'
    
    • 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

    • Inner callback to add the specified Cell to the selection. No event is fired in this implementation.

      Parameters

      • cell: Cell

        Cell to add to the selection.

      Returns void

    • Inner callback to remove the specified Cell from the selection. No event is fired in this implementation.

      Parameters

      • cell: Cell

        Cell to remove from the selection.

      Returns void

    • Adds/removes the specified arrays of Cell to/from the selection.

      Parameters

      • added: Cell[] | null = null

        Array of Cell to add to the selection.

      • removed: Cell[] | null = null

        Array of Cell to remove from the selection.

      Returns void

    • Clears all registered event listeners.

      Subclasses with a destroy method should call super.destroy() at the end of their own cleanup to ensure no stale listeners remain.

      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.

      Example:

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

      Parameters

      • evt: EventObject

        EventObject that represents the event.

      • sender: EventTarget | null = null

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

      Returns void