@@ -13,8 +13,10 @@ const Inspect = () => {
13
13
. onChange ( orientation => graph && graph . dagMode ( orientation ) ) ;
14
14
15
15
// graph config
16
- const NODE_REL_SIZE = 3 ;
16
+ const NODE_REL_SIZE = 5 ;
17
17
const graph = ForceGraph3D ( )
18
+ . width ( 1000 )
19
+ . height ( 500 )
18
20
. dagMode ( 'td' )
19
21
. dagLevelDistance ( 50 )
20
22
. backgroundColor ( '#101020' )
@@ -26,8 +28,9 @@ const Inspect = () => {
26
28
. nodeAutoColorBy ( 'module' )
27
29
. nodeOpacity ( 0.9 )
28
30
. linkDirectionalParticles ( 2 )
29
- . linkDirectionalParticleWidth ( 0.8 )
31
+ . linkDirectionalParticleWidth ( 1 )
30
32
. linkDirectionalParticleSpeed ( 0.006 )
33
+ . linkWidth ( 5 )
31
34
. d3Force ( 'collision' , d3 . forceCollide ( node => Math . cbrt ( node . size ) * NODE_REL_SIZE ) )
32
35
. d3VelocityDecay ( 0.3 ) ;
33
36
@@ -63,9 +66,14 @@ const Inspect = () => {
63
66
}
64
67
} ) ;
65
68
66
- const elem = document . getElementById ( 'graph' ) ;
67
- const Graph = ForceGraph3D ( )
68
- ( elem )
69
+
70
+ graph ( document . getElementById ( 'graph' ) )
71
+ . graphData ( { nodes, links } )
72
+ . onNodeDragEnd ( node => {
73
+ node . fx = node . x ;
74
+ node . fy = node . y ;
75
+ node . fz = node . z ;
76
+ } )
69
77
. onNodeClick ( node => {
70
78
// Aim at node from outside it
71
79
const distance = 40 ;
@@ -75,23 +83,14 @@ const Inspect = () => {
75
83
? { x : node . x * distRatio , y : node . y * distRatio , z : node . z * distRatio }
76
84
: { x : 0 , y : 0 , z : distance } ; // special case if node is in (0,0,0)
77
85
78
- Graph . cameraPosition (
86
+ graph . cameraPosition (
79
87
newPos , // new position
80
88
node , // lookAt ({ x, y, z })
81
89
3000 // ms transition duration
82
90
) ;
83
91
} ) ;
84
92
85
93
86
- graph ( document . getElementById ( 'graph' ) )
87
- . graphData ( { nodes, links } )
88
- . onNodeDragEnd ( node => {
89
- node . fx = node . x ;
90
- node . fy = node . y ;
91
- node . fz = node . z ;
92
- } )
93
-
94
-
95
94
} ) ;
96
95
} , [ ] ) ;
97
96
0 commit comments