diff options
author | Thomas F. K. Jorna <[email protected]> | 2021-07-27 17:12:47 +0200 |
---|---|---|
committer | Thomas F. K. Jorna <[email protected]> | 2021-07-27 17:12:47 +0200 |
commit | d11bad207094cf13f99cf6cf6128de1664f12e4c (patch) | |
tree | 65ba7fba61bb026c5e5339ef3dcc9bd636287265 /pages | |
parent | 5776fe06f09670234bc8939e24c3de3b55286d8d (diff) |
added .current to lastHoverNode references
Diffstat (limited to 'pages')
-rw-r--r-- | pages/index.tsx | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/pages/index.tsx b/pages/index.tsx index 39e827f..1923698 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -423,7 +423,9 @@ export const Graph = function (props: GraphProps) { : 0 const basicSize = 3 + links.length - (!filter.parents ? parentNeighbors : 0) if (physics.highlightAnim) { - const wasHighlightedNode = links.some((link) => isLinkRelatedToNode(link, lastHoverNode)) + const wasHighlightedNode = links.some((link) => + isLinkRelatedToNode(link, lastHoverNode.current), + ) const highlightSize = highlightedNodes[node.id!] ? 1 + opacity * (physics.highlightNodeSize - 1) : lastHoverNode.current?.id! === node.id! @@ -447,7 +449,8 @@ export const Graph = function (props: GraphProps) { } const links = linksByNodeId[node.id!] ?? [] const wasHighlightedNode = - physics.highlightAnim && links.some((link) => isLinkRelatedToNode(link, lastHoverNode)) + physics.highlightAnim && + links.some((link) => isLinkRelatedToNode(link, lastHoverNode.current)) if (globalScale <= physics.labelScale && !highlightedNodes[node.id!] && !wasHighlightedNode) { return } @@ -506,7 +509,7 @@ export const Graph = function (props: GraphProps) { linkDirectionalParticles: physics.particles ? physics.particlesNumber : undefined, linkColor: (link) => { const linkIsHighlighted = isLinkRelatedToNode(link, centralHighlightedNode) - const linkWasHighlighted = isLinkRelatedToNode(link, lastHoverNode) + const linkWasHighlighted = isLinkRelatedToNode(link, lastHoverNode.current) if (physics.highlightAnim) { return linkIsHighlighted ? interPurple(opacity) /*the.colors.purple[500]*/ @@ -519,15 +522,13 @@ export const Graph = function (props: GraphProps) { }, linkWidth: (link) => { const linkIsHighlighted = isLinkRelatedToNode(link, centralHighlightedNode) - const linkWasHighlighted = isLinkRelatedToNode(link, lastHoverNode) + const linkWasHighlighted = isLinkRelatedToNode(link, lastHoverNode.current) if (!physics.highlightAnim) { return linkIsHighlighted ? physics.linkWidth * physics.highlightLinkSize : physics.linkWidth } - return linkIsHighlighted - ? physics.linkWidth * (1 + opacity * (physics.highlightLinkSize - 1)) - : linkWasHighlighted + return linkIsHighlighted || linkWasHighlighted ? physics.linkWidth * (1 + opacity * (physics.highlightLinkSize - 1)) : physics.linkWidth }, |