Skip to content

Commit 2896aa7

Browse files
committed
(fix) Fix arrow head orientation for edges that start at the parent node and have no bending points.
1 parent fc3a55a commit 2896aa7

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/Graph.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,10 @@ function getPath (e, padding, startsAtParent = false) {
3434
}
3535

3636
function Edge ({ graph, parentNode, edge, padding = { top: 0, left: 0 }, ...other }) {
37-
let endPoint = edge.targetPoint
38-
let previousPoint = edge.bendPoints != null && edge.bendPoints.length > 0 ? edge.bendPoints[edge.bendPoints.length - 1] : edge.sourcePoint
37+
const endPoint = edge.targetPoint
38+
const previousPoint = edge.bendPoints != null && edge.bendPoints.length > 0
39+
? edge.bendPoints[edge.bendPoints.length - 1]
40+
: (edge.source === parentNode.id ? { x: edge.sourcePoint.x - padding.left, y: edge.sourcePoint.y - padding.top } : edge.sourcePoint)
3941
const angle = Math.atan2(endPoint.y - previousPoint.y, endPoint.x - previousPoint.x) * 180 / Math.PI
4042
const color = (edge.meta && edge.meta.style && edge.meta.style.color) || '#333333'
4143

0 commit comments

Comments
 (0)