Skip to content

Commit b221f78

Browse files
committed
Enabling physics on startup to get better node layout.
1 parent e451978 commit b221f78

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

templates/showHierarchy_Template.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
};
2323
var options = {
2424
physics: {
25-
enabled: false
25+
enabled: true,
26+
solver: 'repulsion'
2627
},
2728
edges: {
2829
smooth: false // Make edges straight lines.
@@ -34,6 +35,9 @@
3435
var container = document.getElementById('network');
3536
var network = new vis.Network(container, data, options);
3637
var seed = network.getSeed();
38+
network.on("stabilizationIterationsDone", function () {
39+
network.setOptions( { physics: false } );
40+
});
3741

3842
const vscode = acquireVsCodeApi();
3943
const helpTextDiv = document.getElementById('helpText');
@@ -270,6 +274,9 @@
270274
}
271275
options.layout.randomSeed = seed;
272276
network = new vis.Network(container, data, options);
277+
network.on("stabilizationIterationsDone", function () {
278+
network.setOptions( { physics: false } );
279+
});
273280
}
274281

275282
}());

0 commit comments

Comments
 (0)