Bind an event listener. This method can be used with a type parameter by call sites; although it's not necessary it can be helpful to use this to ensure you've thought about what the payload to your event handler is going to be.
Name of the event(s) to bind to.
Function to bind to the given event(s)
Optional
e: anyOptional
insertAtStart: booleanWhether or not to insert this listener at the head of the listener queue. Defaults to false.
Private
eachIterates the objects of the given type in the selection, calling the supplied callback
for each item. The callback's signature should be function(index, item)
. If you don't supply
type
, the default of "Node" will be used.
Function to call with each item.
Type of object to iterate. Defaults to Node.objectType.
Iterates the Nodes and the Groups in the selection, calling the supplied callback
for each item. The callback's signature should be function(index, item)
.
Function to call with each item.
Reloads the content of this Selection, if a generator
was supplied to the constructor. Otherwise
does nothing. A data load start event is fired first, followed by a call to the generator to repopulate,
and then a data load end event is fired. So calling this method on a Selection that you are rendering
to a Surface will cause the Surface to repaint itself.
Sets the action taken when appending an edge or node that would take the selection above its limit for that given type.
One of Selection.DISCARD_EXISTING
(which removes the 0th entry from the list
before insertion of the new value) or Selection.DISCARD_NEW
.
Sets the maximum number of edges the selection can hold. The action taken when appending an edge that would
take the selection above its limit depends on the current capacityPolicy
, which can be either
Selection.DISCARD_EXISTING (the default) or Selection.DISCARD_NEW.
Sets the maximum number of groups the selection can hold. The action taken when appending a group that would
take the selection above its limit depends on the current capacityPolicy
, which can be either
Selection.DISCARD_EXISTING (the default) or Selection.DISCARD_NEW.
Sets the maximum number of nodes the selection can hold. The action taken when appending a node that would
take the selection above its limit depends on the current capacityPolicy
, which can be either
Selection.DISCARD_EXISTING (the default) or Selection.DISCARD_NEW.
Sets the selection's current mode, flushing any objects which do not match the given mode. If you switch to
SelectionModes.isolated
the entire selection is cleared, because it does not know what single supported type
should be until something is subsequently added.
Unbind the given event listener, or all listeners. If you call this method with no arguments then all event listeners are unbound.
Optional
eventOrListener: string | FunctionEither an event name, or an event handler function
Optional
listener: FunctionIf eventOrListener
is defined, this is the event handler to unbind.
A selection is a group of vertices and edges, upon which you can perform bulk operations.