@graphty/graphty-element / Edge / Edge
Class: Edge ​
Defined in: graphty-element/src/Edge.ts:38
Represents a directed edge between two nodes in the graph visualization. Handles rendering of edge lines, arrow heads/tails, and labels with support for various styles.
Constructors ​
Constructor ​
new Edge(
graph,srcNodeId,dstNodeId,styleId,data,opts):Edge
Defined in: graphty-element/src/Edge.ts:93
Creates a new Edge instance connecting two nodes.
Parameters ​
graph ​
The parent graph or graph context
srcNodeId ​
The ID of the source node
dstNodeId ​
The ID of the destination node
styleId ​
The style ID to apply to this edge
data ​
Custom data associated with the edge
opts ​
EdgeOpts = {}
Optional configuration options
Returns ​
Edge
Properties ​
algorithmResults ​
algorithmResults:
AdHocData
Defined in: graphty-element/src/Edge.ts:47
arrowHeadText ​
arrowHeadText:
RichTextLabel|null=null
Defined in: graphty-element/src/Edge.ts:56
arrowMesh ​
arrowMesh:
AbstractMesh|null=null
Defined in: graphty-element/src/Edge.ts:50
arrowTailMesh ​
arrowTailMesh:
AbstractMesh|null=null
Defined in: graphty-element/src/Edge.ts:51
arrowTailText ​
arrowTailText:
RichTextLabel|null=null
Defined in: graphty-element/src/Edge.ts:57
changeManager ​
changeManager:
ChangeManager
Defined in: graphty-element/src/Edge.ts:62
data ​
data:
AdHocData
Defined in: graphty-element/src/Edge.ts:46
dstId ​
dstId:
NodeIdType
Defined in: graphty-element/src/Edge.ts:42
dstNode ​
dstNode:
Node
Defined in: graphty-element/src/Edge.ts:44
id ​
id:
string
Defined in: graphty-element/src/Edge.ts:43
label ​
label:
RichTextLabel|null=null
Defined in: graphty-element/src/Edge.ts:55
mesh ​
mesh:
AbstractMesh|PatternedLineMesh
Defined in: graphty-element/src/Edge.ts:49
opts ​
opts:
EdgeOpts
Defined in: graphty-element/src/Edge.ts:40
parentGraph ​
parentGraph:
GraphContext|Graph
Defined in: graphty-element/src/Edge.ts:39
ray ​
ray:
Ray
Defined in: graphty-element/src/Edge.ts:54
srcId ​
srcId:
NodeIdType
Defined in: graphty-element/src/Edge.ts:41
srcNode ​
srcNode:
Node
Defined in: graphty-element/src/Edge.ts:45
styleId ​
styleId:
EdgeStyleId
Defined in: graphty-element/src/Edge.ts:52
styleUpdates ​
styleUpdates:
AdHocData
Defined in: graphty-element/src/Edge.ts:48
Methods ​
addCalculatedStyle() ​
addCalculatedStyle(
cv):void
Defined in: graphty-element/src/Edge.ts:240
Adds a calculated style value to this edge.
Parameters ​
cv ​
CalculatedValue
The calculated value to add
Returns ​
void
getInterceptPoints() ​
getInterceptPoints():
InterceptPoint
Defined in: graphty-element/src/Edge.ts:875
Calculates ray intersection points with source and destination node meshes. Used to position edges at node surfaces rather than centers.
Returns ​
InterceptPoint
Intersection points for source, destination, and adjusted endpoint
invalidatePositionCache() ​
invalidatePositionCache():
void
Defined in: graphty-element/src/Edge.ts:248
Invalidates the position cache, forcing the edge to be recalculated on the next update. Call this when a connected node's size changes (e.g., due to selection).
Returns ​
void
transformArrowCap() ​
transformArrowCap():
EdgeLine
Defined in: graphty-element/src/Edge.ts:588
Calculates and applies transformations for arrow head and tail meshes. Adjusts edge line endpoints to create gaps for arrows.
Returns ​
EdgeLine
Edge line positions adjusted for arrow placement
transformEdgeMesh() ​
transformEdgeMesh(
srcPoint,dstPoint):void
Defined in: graphty-element/src/Edge.ts:565
Transforms the edge mesh to position it between source and destination points. Handles different mesh types (solid, patterned, 2D, bezier).
Parameters ​
srcPoint ​
Vector3
The source point position
dstPoint ​
Vector3
The destination point position
Returns ​
void
update() ​
update():
void
Defined in: graphty-element/src/Edge.ts:257
Updates the edge's visual representation based on current node positions and style changes. Performs dirty checking to skip updates when nodes haven't moved.
Returns ​
void
updateRays() ​
staticupdateRays(g):void
Defined in: graphty-element/src/Edge.ts:524
Updates ray directions for all edges in the graph to enable accurate mesh intersections.
Parameters ​
g ​
The graph or graph context containing the edges
Returns ​
void
updateStyle() ​
updateStyle(
styleId):void
Defined in: graphty-element/src/Edge.ts:361
Updates the edge's style by changing its styleId and recreating visual elements.
Parameters ​
styleId ​
The new style ID to apply
Returns ​
void