@graphty/graphty-element / Node / Node
Class: Node ​
Defined in: graphty-element/src/Node.ts:26
Represents a node in the graph visualization with its mesh, label, and associated data. Manages node rendering, styling, drag behavior, and interactions with the layout engine.
Constructors ​
Constructor ​
new Node(
graph,nodeId,styleId,data,opts):Node
Defined in: graphty-element/src/Node.ts:64
Creates a new Node instance with mesh, label, and behaviors.
Parameters ​
graph ​
The parent graph or graph context that owns this node
nodeId ​
Unique identifier for this node
styleId ​
Style identifier determining the node's visual appearance
data ​
AdHocData<string | number>
Custom data associated with this node
opts ​
NodeOpts = {}
Optional configuration options for the node
Returns ​
Node
Properties ​
algorithmResults ​
algorithmResults:
AdHocData
Defined in: graphty-element/src/Node.ts:31
changeManager ​
changeManager:
ChangeManager
Defined in: graphty-element/src/Node.ts:40
data ​
data:
AdHocData<string|number>
Defined in: graphty-element/src/Node.ts:30
dragging ​
dragging:
boolean=false
Defined in: graphty-element/src/Node.ts:36
dragHandler? ​
optionaldragHandler:NodeDragHandler
Defined in: graphty-element/src/Node.ts:35
id ​
id:
NodeIdType
Defined in: graphty-element/src/Node.ts:29
label? ​
optionallabel:RichTextLabel
Defined in: graphty-element/src/Node.ts:34
mesh ​
mesh:
AbstractMesh
Defined in: graphty-element/src/Node.ts:33
opts ​
opts:
NodeOpts
Defined in: graphty-element/src/Node.ts:28
parentGraph ​
parentGraph:
GraphContext|Graph
Defined in: graphty-element/src/Node.ts:27
pinOnDrag ​
pinOnDrag:
boolean
Defined in: graphty-element/src/Node.ts:38
size ​
size:
number
Defined in: graphty-element/src/Node.ts:39
styleId ​
styleId:
NodeStyleId
Defined in: graphty-element/src/Node.ts:37
styleUpdates ​
styleUpdates:
AdHocData
Defined in: graphty-element/src/Node.ts:32
Methods ​
addCalculatedStyle() ​
addCalculatedStyle(
cv):void
Defined in: graphty-element/src/Node.ts:129
Adds a calculated style value to this node's change manager.
Parameters ​
cv ​
CalculatedValue
The calculated value to add to the node's styling system
Returns ​
void
getPosition() ​
getPosition():
object
Defined in: graphty-element/src/Node.ts:447
Gets the current 3D position of the node's mesh.
Returns ​
object
An object containing the x, y, and z coordinates of the node
x ​
x:
number
y ​
y:
number
z ​
z:
number
isPinned() ​
isPinned():
boolean
Defined in: graphty-element/src/Node.ts:459
Checks whether the node is currently pinned in place.
Returns ​
boolean
True if the node is pinned, false otherwise
isSelected() ​
isSelected():
boolean
Defined in: graphty-element/src/Node.ts:468
Checks whether the node is currently selected.
Returns ​
boolean
True if the node is selected, false otherwise
pin() ​
pin():
void
Defined in: graphty-element/src/Node.ts:284
Pins the node in place, preventing the layout engine from moving it.
Returns ​
void
unpin() ​
unpin():
void
Defined in: graphty-element/src/Node.ts:291
Unpins the node, allowing the layout engine to move it again.
Returns ​
void
update() ​
update():
void
Defined in: graphty-element/src/Node.ts:137
Updates the node's mesh position and style based on layout engine and style changes. Handles mesh recreation if disposed and applies any pending style updates.
Returns ​
void
updateStyle() ​
updateStyle(
styleId):void
Defined in: graphty-element/src/Node.ts:183
Updates the node's visual style by recreating the mesh with the specified style. Preserves the node's position and reattaches behaviors and labels.
Parameters ​
styleId ​
The new style identifier to apply to the node
Returns ​
void