Browse Source

only use shape.radius if availible; fixes #1625 (#2005)

codeClimate
Alexander Wunschik 8 years ago
committed by GitHub
parent
commit
cd29400412
2 changed files with 4 additions and 4 deletions
  1. +2
    -2
      lib/network/modules/components/physics/BarnesHutSolver.js
  2. +2
    -2
      lib/network/modules/components/physics/FA2BasedRepulsionSolver.js

+ 2
- 2
lib/network/modules/components/physics/BarnesHutSolver.js View File

@ -115,7 +115,7 @@ class BarnesHutSolver {
dx = distance;
}
if (this.overlapAvoidanceFactor < 1) {
if (this.overlapAvoidanceFactor < 1 && node.shape.radius) {
distance = Math.max(0.1 + (this.overlapAvoidanceFactor * node.shape.radius), distance - node.shape.radius);
}
@ -462,4 +462,4 @@ class BarnesHutSolver {
}
export default BarnesHutSolver;
export default BarnesHutSolver;

+ 2
- 2
lib/network/modules/components/physics/FA2BasedRepulsionSolver.js View File

@ -21,7 +21,7 @@ class ForceAtlas2BasedRepulsionSolver extends BarnesHutSolver {
dx = distance;
}
if (this.overlapAvoidanceFactor < 1) {
if (this.overlapAvoidanceFactor < 1 && node.shape.radius) {
distance = Math.max(0.1 + (this.overlapAvoidanceFactor * node.shape.radius), distance - node.shape.radius);
}
@ -37,4 +37,4 @@ class ForceAtlas2BasedRepulsionSolver extends BarnesHutSolver {
}
}
export default ForceAtlas2BasedRepulsionSolver;
export default ForceAtlas2BasedRepulsionSolver;

Loading…
Cancel
Save