Browse Source

Merge pull request #1987 from Stexxen/develop

Resolve issue #1857 Fixed node positioning with improvedLayout:true
codeClimate
Alexander Wunschik 8 years ago
committed by GitHub
parent
commit
ae1ecf51de
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