forked from security_vision/semantic_graph
simulation prerendering is now a config var
This commit is contained in:
parent
f348decd02
commit
f9dec8a947
1 changed files with 5 additions and 2 deletions
3
graph.js
3
graph.js
|
@ -3,6 +3,7 @@ const CONFIG = {
|
||||||
'nodeSize': 16,
|
'nodeSize': 16,
|
||||||
'baseUrl': 'https://www.securityvision.io/wiki/index.php/',
|
'baseUrl': 'https://www.securityvision.io/wiki/index.php/',
|
||||||
'dataUrl': 'semantic_data.json',
|
'dataUrl': 'semantic_data.json',
|
||||||
|
'preSimulate': true, // run simulation before starting, so we don't start with lines jumping around
|
||||||
'labels': {
|
'labels': {
|
||||||
'rotate': true,
|
'rotate': true,
|
||||||
},
|
},
|
||||||
|
@ -302,9 +303,11 @@ function buildGraph(data) {
|
||||||
|
|
||||||
|
|
||||||
// simulate the first bit without drawing, so we don't have the 'jumping' graph in the beginning
|
// simulate the first bit without drawing, so we don't have the 'jumping' graph in the beginning
|
||||||
|
if (CONFIG.preSimulate) {
|
||||||
for (var i = 0, n = Math.ceil(Math.log(simulation.alphaMin()) / Math.log(1 - simulation.alphaDecay())); i < n; ++i) {
|
for (var i = 0, n = Math.ceil(Math.log(simulation.alphaMin()) / Math.log(1 - simulation.alphaDecay())); i < n; ++i) {
|
||||||
simulation.tick();
|
simulation.tick();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return svg.node();
|
return svg.node();
|
||||||
|
|
Loading…
Reference in a new issue