summaryrefslogtreecommitdiff
path: root/pages/index.tsx
diff options
context:
space:
mode:
authorThomas F. K. Jorna <[email protected]>2021-07-22 21:43:08 +0200
committerThomas F. K. Jorna <[email protected]>2021-07-22 21:43:08 +0200
commitb3c1b737e7a52bef96e7170c174cbbeb4d7f623d (patch)
tree3f4547d2f9b94910baa2fa87a74939632c9c108a /pages/index.tsx
parent06a5d8633c79f4cfa240fdeffcd5fac56586aab8 (diff)
fix moving around when hovering in local mode
Diffstat (limited to 'pages/index.tsx')
-rw-r--r--pages/index.tsx24
1 files changed, 15 insertions, 9 deletions
diff --git a/pages/index.tsx b/pages/index.tsx
index 06c7dc2..e5679f2 100644
--- a/pages/index.tsx
+++ b/pages/index.tsx
@@ -1,4 +1,4 @@
-import React, { ComponentPropsWithoutRef, useEffect, useRef, useState } from 'react'
+import React, { ComponentPropsWithoutRef, useEffect, useRef, useState, useMemo } from 'react'
import { usePersistantState } from '../util/persistant-state'
const d3promise = import('d3-force-3d')
@@ -489,7 +489,10 @@ export const Tweaks = function (props: TweakProps) {
onChange={(value) => setPhysics({ ...physics, highlightNodeSize: value })}
/>
<Flex justifyContent="space-between">
- <Text></Text>
+ <Text> Highlight node color </Text>
+ </Flex>
+ <Flex justifyContent="space-between">
+ <Text> Highlight link color </Text>
</Flex>
</EnableSection>
</VStack>
@@ -606,13 +609,16 @@ export const Graph = function (props: GraphProps) {
return scopedNodeIds.includes(sourceId as string) && scopedNodeIds.includes(targetId as string)
})
- const scopedGraphData =
- scope.nodeIds.length === 0
- ? graphData
- : {
- nodes: scopedNodes,
- links: scopedLinks,
- }
+ const scopedGraphData = useMemo(
+ () =>
+ scope.nodeIds.length === 0
+ ? graphData
+ : {
+ nodes: scopedNodes,
+ links: scopedLinks,
+ },
+ [scope],
+ )
useEffect(() => {
;(async () => {