SelectionBehavior
- Kind
- class
- Source
- src/behaviors/SelectionBehavior.js:108
Description
Built-in behavior for node and edge selection state.
Signature
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
options | Object | optional | Selection options such as nodeClick, edgeClick, selectedConnectedEdges, saved-selection attribute names, and inactive-item styling. |
Returns
Behavior that can be attached through helios.useBehavior('selection', options).
SelectionBehaviorNotes
Selection state is serializable. The behavior also synchronizes picking, labels, and optional connected-edge highlighting.
Instance Properties
id
Source: src/behaviors/SelectionBehavior.js:109
Id exposed by the class.
Filtering And State
Graph filtering and interaction state. When active, FilterBehavior and SelectionBehavior coordinate this area.
getPublicState()
Source: src/behaviors/SelectionBehavior.js:375
Returns the current public state value or state.
Example
const value = helios.getPublicState();
ensureStateStyleDefaults()
Source: src/behaviors/SelectionBehavior.js:383
Configures or reads ensure state style defaults.
applyOtherElementsState()
Source: src/behaviors/SelectionBehavior.js:387
Updates the other elements state state on the current instance.
Network And Persistence
Network replacement, serialization, and visualization state persistence. ExporterBehavior and InterfaceBehavior can surface parts of this flow in the UI.
attach(context)
Source: src/behaviors/SelectionBehavior.js:136
Configures or reads attach.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
context | Value passed to attach. |
serialize()
Source: src/behaviors/SelectionBehavior.js:196
Handles serialize for the current graph or visualization state.
restore(snapshot = {}) → {this}
Source: src/behaviors/SelectionBehavior.js:357
Updates the restore state on the current instance.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
snapshot | optional | {} | Value passed to restore. |
Returns
This instance.
TypethiscenterSelectedNodesOrNetwork(options = {}) → {Object|this}
Source: src/behaviors/SelectionBehavior.js:623
Read or set the center selected nodes or network setting.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
options | Object | optional | {} | Options object for this operation. |
Returns
Current center selected nodes or network value when called without arguments; otherwise this instance for chaining.
TypeObject|thisExample
helios.centerSelectedNodesOrNetwork({
enabled: true,
});
saveSelectionToAttribute(name)
Source: src/behaviors/SelectionBehavior.js:682
Handles selection to attribute for the current graph or visualization state.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
name | string | Attribute or API identifier. |
restoreSelectionFromAttribute(name) → {this}
Source: src/behaviors/SelectionBehavior.js:732
Updates the selection from attribute state on the current instance.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
name | string | Attribute or API identifier. |
Returns
This instance.
TypethisattachNetworkAttributeListeners()
Source: src/behaviors/SelectionBehavior.js:743
Configures or reads attach network attribute listeners.
handleNetworkReplaced()
Source: src/behaviors/SelectionBehavior.js:795
Configures or reads handle network replaced.
Appearance
Visual rendering settings for nodes, edges, labels, legends, density, shading, and background. AppearanceBehavior, LabelsBehavior, and LegendsBehavior cover the built-in controls.
applySelectionLabelDefaults()
Source: src/behaviors/SelectionBehavior.js:416
Updates the selection label defaults state on the current instance.
Rendering And Picking
Render requests, picking, framebuffer inspection, and attribute tracking. HoverBehavior and SelectionBehavior use these lower-level hooks.
syncPicking()
Source: src/behaviors/SelectionBehavior.js:395
Configures or reads sync picking.
Configuration
General configuration setters and compatibility helpers.
setSelectionBinding(value = CURRENT_SELECTION_VALUE) → {Object|this}
Source: src/behaviors/SelectionBehavior.js:399
Read or set the set selection binding setting.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
value | optional | CURRENT_SELECTION_VALUE | New set selection binding value. Omit this argument to read the current value. |
Returns
Current set selection binding value when called without arguments; otherwise this instance for chaining.
TypeObject|thisExample
helios.setSelectionBinding(1);
setSelectorRules(rules = [], options = {}) → {this}
Source: src/behaviors/SelectionBehavior.js:407
Set the selector rules setting.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
rules | optional | [] | Value passed to setSelectorRules. | |
options | Object | optional | {} | Options object for this operation. |
Returns
This instance.
TypethissetNodeSelected(index, selected, options = {}) → {this}
Source: src/behaviors/SelectionBehavior.js:431
Set the node selected setting.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
index | number | Node, edge, or attribute index. | ||
selected | Value passed to setNodeSelected. | |||
options | Object | optional | {} | Options object for this operation. |
Returns
This instance.
TypethissetEdgeSelected(index, selected, options = {}) → {this}
Source: src/behaviors/SelectionBehavior.js:453
Set the edge selected setting.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
index | number | Node, edge, or attribute index. | ||
selected | Value passed to setEdgeSelected. | |||
options | Object | optional | {} | Options object for this operation. |
Returns
This instance.
TypethisclearSelection(options = {}) → {Object|this}
Source: src/behaviors/SelectionBehavior.js:472
Read or set the clear selection setting.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
options | Object | optional | {} | Options object for this operation. |
Returns
Current clear selection value when called without arguments; otherwise this instance for chaining.
TypeObject|thisExample
helios.clearSelection({
enabled: true,
});
toggleSelection(kind, index, options = {})
Source: src/behaviors/SelectionBehavior.js:507
Updates the selection state on the current instance.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
kind | Value passed to toggleSelection. | |||
index | number | Node, edge, or attribute index. | ||
options | Object | optional | {} | Options object for this operation. |
Utilities
Additional public helpers that do not belong to a narrower API area.
detach()
Source: src/behaviors/SelectionBehavior.js:153
Manages detach for the current instance.
update(options = {}) → {Object|this}
Source: src/behaviors/SelectionBehavior.js:163
Read or set the update setting.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
options | Object | optional | {} | Options object for this operation. |
Returns
Current update value when called without arguments; otherwise this instance for chaining.
TypeObject|thisExample
helios.update({
enabled: true,
});
stateEntries()
Source: src/behaviors/SelectionBehavior.js:215
Configures or reads state entries.
emitChange(reason, detail = {})
Source: src/behaviors/SelectionBehavior.js:371
Configures or reads emit change.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
reason | string | Reason for this operation. | ||
detail | optional | {} | Event payload passed to listeners. |
applySelectedConnectedEdges()
Source: src/behaviors/SelectionBehavior.js:391
Updates the selected connected edges state on the current instance.
selectOnly(kind, index, options = {})
Source: src/behaviors/SelectionBehavior.js:494
Configures or reads select only.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
kind | Value passed to selectOnly. | |||
index | number | Node, edge, or attribute index. | ||
options | Object | optional | {} | Options object for this operation. |
applyNodeSelectionSet(indices, mode = 'add', options = {})
Source: src/behaviors/SelectionBehavior.js:512
Updates the node selection set state on the current instance.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
indices | Array<number>|TypedArray | Node or edge indices used by the operation. | ||
mode | string | optional | 'add' | Mode for this operation. |
options | Object | optional | {} | Options object for this operation. |
Example
helios.applyNodeSelectionSet([0, 1, 2]);
applyEdgeSelectionSet(indices, mode = 'add', options = {})
Source: src/behaviors/SelectionBehavior.js:550
Updates the edge selection set state on the current instance.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
indices | Array<number>|TypedArray | Node or edge indices used by the operation. | ||
mode | string | optional | 'add' | Mode for this operation. |
options | Object | optional | {} | Options object for this operation. |
Example
helios.applyEdgeSelectionSet([0, 1, 2]);
selectNodes(indices, options = {})
Source: src/behaviors/SelectionBehavior.js:588
Configures or reads select nodes.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
indices | Array<number>|TypedArray | Node or edge indices used by the operation. | ||
options | Object | optional | {} | Options object for this operation. |
Example
helios.selectNodes([0, 1, 2]);
selectEdges(indices, options = {})
Source: src/behaviors/SelectionBehavior.js:592
Configures or reads select edges.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
indices | Array<number>|TypedArray | Node or edge indices used by the operation. | ||
options | Object | optional | {} | Options object for this operation. |
Example
helios.selectEdges([0, 1, 2]);
buildNodeSelectionQuery(rules = [])
Source: src/behaviors/SelectionBehavior.js:596
Configures or reads build node selection query.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
rules | optional | [] | Value passed to buildNodeSelectionQuery. |
applyNodeSelectionQuery(rules, mode = 'add')
Source: src/behaviors/SelectionBehavior.js:605
Updates the node selection query state on the current instance.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
rules | Value passed to applyNodeSelectionQuery. | |||
mode | string | optional | 'add' | Mode for this operation. |
expandSelectionToNeighbors()
Source: src/behaviors/SelectionBehavior.js:613
Configures or reads expand selection to neighbors.
collectSavedSelectionAttributes()
Source: src/behaviors/SelectionBehavior.js:646
Configures or reads collect saved selection attributes.
ensureBooleanSelectionAttribute(network, scope, name)
Source: src/behaviors/SelectionBehavior.js:662
Configures or reads ensure boolean selection attribute.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
network | HeliosNetwork | Network instance to read from or mutate. | ||
scope | Attribute scope: node, edge, or network. | |||
name | string | Attribute or API identifier. |
collectSelectionAttributeIndices(scope, name)
Source: src/behaviors/SelectionBehavior.js:705
Configures or reads collect selection attribute indices.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
scope | Attribute scope: node, edge, or network. | |||
name | string | Attribute or API identifier. |
handleGraphClick(event)
Source: src/behaviors/SelectionBehavior.js:759
Configures or reads handle graph click.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
event | Value passed to handleGraphClick. |
handleGraphDoubleClick(event)
Source: src/behaviors/SelectionBehavior.js:780
Configures or reads handle graph double click.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
event | Value passed to handleGraphDoubleClick. |
handleUiBindingChange(event)
Source: src/behaviors/SelectionBehavior.js:808
Configures or reads handle ui binding change.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
event | Value passed to handleUiBindingChange. |