Skip to content

Commit 50ba087

Browse files
rokotyanlee00678
authored andcommitted
Component | Graph: Animate grayed out links too
Otherwise when a data update happens and links change positions, their particles will remain at their old locations
1 parent 86463e9 commit 50ba087

File tree

1 file changed

+3
-4
lines changed
  • packages/ts/src/components/graph

1 file changed

+3
-4
lines changed

packages/ts/src/components/graph/index.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -698,9 +698,8 @@ export class Graph<
698698
const hasLinksWithFlow = links.some((d, i) => getBoolean(d, config.linkFlow, i))
699699
if (!hasLinksWithFlow) return
700700

701-
const linkElements = this._linksGroup.selectAll<SVGGElement, GraphLink<N, L>>(`.${linkSelectors.gLink}`)
702-
const linksToAnimate = linkElements.filter(d => !d._state.greyout)
703-
linksToAnimate.each((l, i, els) => {
701+
const linkGroups = this._linksGroup.selectAll<SVGGElement, GraphLink<N, L>>(`.${linkSelectors.gLink}`)
702+
linkGroups.each((l, i, els) => {
704703
let linkFlowAnimDuration = getNumber(l, config.linkFlowAnimDuration, l._indexGlobal)
705704
const linkFlowParticleSpeed = getNumber(l, config.linkFlowParticleSpeed, l._indexGlobal)
706705

@@ -712,7 +711,7 @@ export class Graph<
712711
}
713712
l._state.flowAnimTime = (elapsed % linkFlowAnimDuration) / linkFlowAnimDuration
714713
})
715-
animateLinkFlow(linksToAnimate, this.config, this._scale, this._linkPathLengthMap)
714+
animateLinkFlow(linkGroups, this.config, this._scale, this._linkPathLengthMap)
716715
}
717716

718717
private _onZoom (t: ZoomTransform, event?: D3ZoomEvent<SVGGElement, unknown>): void {

0 commit comments

Comments
 (0)