Browse Source

Resolve issue almende/vis#1857

Perturbing the nodes was being performed on all nodes regardless of whether they were set as fixed.
codeClimate
Steven Pearce 8 years ago
parent
commit
eb675cd7f6
1 changed files with 5 additions and 2 deletions
  1. +5
    -2
      lib/network/modules/LayoutEngine.js

+ 5
- 2
lib/network/modules/LayoutEngine.js View File

@ -234,8 +234,11 @@ class LayoutEngine {
// perturb the nodes a little bit to force the physics to kick in
let offset = 70;
for (let i = 0; i < this.body.nodeIndices.length; i++) {
this.body.nodes[this.body.nodeIndices[i]].x += (0.5 - this.seededRandom())*offset;
this.body.nodes[this.body.nodeIndices[i]].y += (0.5 - this.seededRandom())*offset;
// Only perturb the nodes that aren't fixed
if (this.body.nodes[this.body.nodeIndices[i]].predefinedPosition === false) {
this.body.nodes[this.body.nodeIndices[i]].x += (0.5 - this.seededRandom())*offset;
this.body.nodes[this.body.nodeIndices[i]].y += (0.5 - this.seededRandom())*offset;
}
}
// uncluster all clusters

Loading…
Cancel
Save