Skip to content

Commit

Permalink
Component | Graph | Link: Adding transition to link arrows
Browse files Browse the repository at this point in the history
#0
  • Loading branch information
rokotyan committed Jan 25, 2024
1 parent 1afbb3e commit 71ad692
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/ts/src/components/graph/modules/link/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,11 @@ export function updateLinks<N extends GraphInputNode, L extends GraphInputLink>

// Calculate the angle for the arrowhead
const angle = Math.atan2(p2.y - p1.y, p2.x - p1.x) * (180 / Math.PI)
const arrowWasShownBefore = linkArrow.attr('href')
linkArrow
.attr('href', `#${getLinkArrowDefId(linkArrowStyle)}`)

smartTransition(linkArrow, arrowWasShownBefore ? duration : 0)
.attr('fill', linkColor)
.attr('transform', `translate(${p1.x}, ${p1.y}) rotate(${angle})`)
} else {
Expand Down

0 comments on commit 71ad692

Please sign in to comment.