summaryrefslogtreecommitdiff
path: root/pages/index.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'pages/index.tsx')
-rw-r--r--pages/index.tsx27
1 files changed, 13 insertions, 14 deletions
diff --git a/pages/index.tsx b/pages/index.tsx
index 3200bb9..6221750 100644
--- a/pages/index.tsx
+++ b/pages/index.tsx
@@ -203,7 +203,11 @@ export function GraphPage() {
/>
) : (
<Box position="absolute" zIndex="overlay" marginTop="2%" marginLeft="2%">
- <IconButton icon={<SettingsIcon />} onClick={() => setShowTweaks(true)} />
+ <IconButton
+ aria-label="Settings"
+ icon={<SettingsIcon />}
+ onClick={() => setShowTweaks(true)}
+ />
</Box>
)}
<Graph
@@ -741,15 +745,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, ' +
- (Object.keys(highlightedNodes).length === 0
- ? fadeFactor
+ 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,
@@ -780,13 +784,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,