summaryrefslogtreecommitdiff
path: root/pages
diff options
context:
space:
mode:
authorKirill Rogovoy <[email protected]>2021-07-22 21:06:01 +0300
committerKirill Rogovoy <[email protected]>2021-07-22 22:18:34 +0300
commitcdf2c29adb36f3ea84be628d6cb36d12ec5dcee9 (patch)
treefdd684cf932e7c08ebf0e5fcf1c450b228d49bcd /pages
parent06a5d8633c79f4cfa240fdeffcd5fac56586aab8 (diff)
Minor changes
Diffstat (limited to 'pages')
-rw-r--r--pages/index.tsx19
1 files changed, 7 insertions, 12 deletions
diff --git a/pages/index.tsx b/pages/index.tsx
index 06c7dc2..8bc3157 100644
--- a/pages/index.tsx
+++ b/pages/index.tsx
@@ -731,15 +731,15 @@ export const Graph = function (props: GraphProps) {
const fadeFactor = Math.min((3 * (globalScale - physics.labelScale)) / physics.labelScale, 1)
- // draw label background
- ctx.fillStyle =
- 'rgba(20, 20, 20, ' +
- (highlightedNodes.length === 0
+ const opacity =
+ highlightedNodes.length === 0
? 0.5 * fadeFactor
: highlightedNodes[node.id!]
? 0.5
- : 0.15 * fadeFactor) +
- ')'
+ : 0.15 * fadeFactor
+
+ // draw label background
+ ctx.fillStyle = `rgba(20, 20, 20, ${opacity})`
ctx.fillRect(
node.x! - bckgDimensions[0] / 2,
node.y! - bckgDimensions[1] / 2,
@@ -770,13 +770,8 @@ export const Graph = function (props: GraphProps) {
return linkIsHighlighted ? '#a991f1' : '#666666'
},
- linkWidth: (link) => {
+ linkWidth: () => {
return physics.linkWidth
- const linkIsHighlighted =
- (link.source as NodeObject).id! === centralHighlightedNode?.id! ||
- (link.target as NodeObject).id! === centralHighlightedNode?.id!
-
- return linkIsHighlighted ? physics.highlightLinkSize * physics.linkWidth : physics.linkWidth
},
linkDirectionalParticleWidth: physics.particlesWidth,