summaryrefslogtreecommitdiff
path: root/pages
diff options
context:
space:
mode:
authorKirill Rogovoy <[email protected]>2021-07-23 17:16:08 +0300
committerKirill Rogovoy <[email protected]>2021-07-23 17:16:08 +0300
commit444193ce3749fd8646c5b58135d07524ddc7aed0 (patch)
treea88212ce7c424c1df91c7aea68f736b51c8816e5 /pages
parent7f8afb99e24d546973662ef2d59cf85db9d019dd (diff)
Make physical forces disablable
Diffstat (limited to 'pages')
-rw-r--r--pages/index.tsx14
1 files changed, 5 insertions, 9 deletions
diff --git a/pages/index.tsx b/pages/index.tsx
index 170935e..b78e357 100644
--- a/pages/index.tsx
+++ b/pages/index.tsx
@@ -664,12 +664,10 @@ export const Graph = function (props: GraphProps) {
fg.d3Force('y', null)
threeDim ? fg.d3Force('z', null) : null
}
- fg.d3Force('link').strength(physics.linkStrength)
- fg.d3Force('link').iterations(physics.linkIts)
- physics.collision
- ? fg.d3Force('collide', d3.forceCollide().radius(20))
- : fg.d3Force('collide', null)
- fg.d3Force('charge').strength(physics.charge)
+ physics.linkStrength && fg.d3Force('link').strength(physics.linkStrength)
+ physics.linkIts && fg.d3Force('link').iterations(physics.linkIts)
+ physics.charge && fg.d3Force('charge').strength(physics.charge)
+ fg.d3Force('collide', physics.collision ? d3.forceCollide().radius(20) : null)
})()
})
@@ -699,7 +697,6 @@ export const Graph = function (props: GraphProps) {
}
const theme = useTheme()
- console.log(theme)
const graphCommonProps: ComponentPropsWithoutRef<typeof TForceGraph2D> = {
graphData: scopedGraphData,
width: windowWidth,
@@ -790,8 +787,7 @@ export const Graph = function (props: GraphProps) {
d3AlphaDecay: physics.alphaDecay,
d3AlphaMin: physics.alphaMin,
d3VelocityDecay: physics.velocityDecay,
-
- onNodeClick: onNodeClick,
+ onNodeClick,
onBackgroundClick: () => {
setScope((currentScope) => ({
...currentScope,