Specifies if events are handled.
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.
Specifies if events can be fired. Default is true.
Optional source for events.
Reference to the enclosing AbstractGraph.
Maps from cells to handlers.
Defines the maximum number of handlers to paint individually.
Keeps a reference to an event listener for later removal.
Static ReadonlypluginBinds 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.
Hooks to create a new EdgeHandler for the given CellState.
This method relies on the registered elements in EdgeStyleRegistry to know which EdgeHandler to create.
If the EdgeStyle is not registered, it will return the EdgeHandler registered under the 'default' handler kind.
CellState to create the handler for.
the EdgeStyleFunction that let choose the actual edge handler.
Hooks to create a new handler for the given cell state.
This implementation returns a new EdgeHandler if the corresponding cell is an edge, otherwise it returns an VertexHandler.
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.
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))
EventObject that represents the event.
Optional sender to be passed to the listener. Default value is the return value of getEventSource.
Returns eventSource.
Reloads or updates all handlers.
Returns enabled.
Returns eventsEnabled.
Returns true if the given handler is active and should not be redrawn.
Redirects the given event to the handlers.
Redirects the given event to the handlers.
Redirects the given event to the handlers.
Destroys the handler and all its resources and DOM nodes.
Reloads or updates all handlers.
Removes all occurrences of the given listener from eventListeners.
Resets all handlers.
Sets the factory used by createEdgeHandler to instantiate the handler of a selected edge whose
EdgeStyle is registered under the given EdgeStyleHandlerKind in EdgeStyleRegistry.
Use it to have maxGraph create a custom EdgeHandler subclass, instead of subclassing this plugin:
const selectionCellsHandler = graph.getPlugin<SelectionCellsHandler>('SelectionCellsHandler')!;
selectionCellsHandler.setEdgeHandlerFactory('elbow', (state) => new MyElbowEdgeHandler(state));
The three built-in kinds are 'default', 'elbow' and 'segment'. Custom kinds are supported: register the
EdgeStyle with EdgeStyleRegistry.add(name, edgeStyle, { handlerKind: 'my-kind' }), then declare the matching
factory here. Edge styles whose kind has no factory fall back to the 'default' one.
The factory only affects handlers created after this call.
the EdgeStyleHandlerKind the factory applies to.
creates the EdgeHandler for the CellState it receives.
Sets a single factory used by createEdgeHandler for every EdgeStyleHandlerKind, whatever the
EdgeStyle of the selected edge.
Use it when the same EdgeHandler implementation fits all edges, instead of repeating setEdgeHandlerFactory for each kind:
const selectionCellsHandler = graph.getPlugin<SelectionCellsHandler>('SelectionCellsHandler')!;
selectionCellsHandler.setEdgeHandlerFactoryForAllKinds((state) => new MyEdgeHandler(state));
This also covers the kinds registered in EdgeStyleRegistry after this call, as any kind without a
dedicated factory falls back to the 'default' one.
creates the EdgeHandler for the CellState it receives.
This discards all factories previously set with setEdgeHandlerFactory, including those declared for custom kinds. Call it before declaring any per-kind factory, not after.
Sets the factory used by createHandler to instantiate the handler of a selected vertex.
Use it to have maxGraph create a custom VertexHandler subclass, instead of subclassing this plugin:
const selectionCellsHandler = graph.getPlugin<SelectionCellsHandler>('SelectionCellsHandler')!;
selectionCellsHandler.setVertexHandlerFactory((state) => new MyVertexHandler(state));
It only affects handlers created after this call, so set it before the first selection occurs.
creates the VertexHandler for the CellState it receives.
An event handler that manages cell handlers and invokes their mouse event processing functions.
Events
InternalEvent.ADD
Fires if a cell has been added to the selection. The
stateproperty contains the CellState that has been added.InternalEvent.REMOVE
Fires if a cell has been remove from the selection. The
stateproperty contains the CellState that has been removed.