summaryrefslogtreecommitdiff
path: root/pages/index.tsx
diff options
context:
space:
mode:
authorThomas F. K. Jorna <[email protected]>2021-07-23 15:44:40 +0200
committerThomas F. K. Jorna <[email protected]>2021-07-23 15:44:40 +0200
commit39e6ec5f16ac782ff7deaa382b72a603d662b235 (patch)
treed7c00989db05c87ee948c4fa0ef05abd02ae0aa2 /pages/index.tsx
parent4f08197bc4c5b1171f50a28c841ccd2b05559541 (diff)
parent7f3943439a7a5e20df1cca1578140a25eb973ad0 (diff)
manual merge
Diffstat (limited to 'pages/index.tsx')
-rw-r--r--pages/index.tsx35
1 files changed, 28 insertions, 7 deletions
diff --git a/pages/index.tsx b/pages/index.tsx
index ff3f8d0..da00d0a 100644
--- a/pages/index.tsx
+++ b/pages/index.tsx
@@ -645,10 +645,31 @@ export const Graph = function (props: GraphProps) {
;(async () => {
const fg = threeDim ? graph3dRef.current : graph2dRef.current
const d3 = await d3promise
- // fg.d3Force('x', null)
- // fg.d3Force('y', null)
- fg.d3Force('collide', d3.forceCollide().radius(10))
- // fg.d3Force('charge').strength(1)
+ if (physics.gravityOn) {
+ fg.d3Force('x', d3.forceX().strength(physics.gravity))
+ fg.d3Force('y', d3.forceY().strength(physics.gravity))
+ if (threeDim) {
+ if (physics.galaxy) {
+ fg.d3Force('x', d3.forceX().strength(physics.gravity / 5))
+ fg.d3Force('z', d3.forceZ().strength(physics.gravity / 5))
+ } else {
+ fg.d3Force('x', d3.forceX().strength(physics.gravity))
+ fg.d3Force('z', d3.forceZ().strength(physics.gravity))
+ }
+ } else {
+ fg.d3Force('z', null)
+ }
+ } else {
+ fg.d3Force('x', null)
+ 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)
})()
})
@@ -766,9 +787,9 @@ export const Graph = function (props: GraphProps) {
linkWidth: physics.linkWidth,
linkDirectionalParticleWidth: physics.particlesWidth,
- // d3AlphaDecay: physics.alphaDecay,
- // d3AlphaMin: physics.alphaMin,
- // d3VelocityDecay: physics.velocityDecay,
+ d3AlphaDecay: physics.alphaDecay,
+ d3AlphaMin: physics.alphaMin,
+ d3VelocityDecay: physics.velocityDecay,
onNodeClick: onNodeClick,
onBackgroundClick: () => {