From cd2940041212d82682ba17415e2be50aaffcf0ef Mon Sep 17 00:00:00 2001 From: Alexander Wunschik Date: Wed, 7 Sep 2016 09:06:11 +0200 Subject: [PATCH] only use shape.radius if availible; fixes #1625 (#2005) --- lib/network/modules/components/physics/BarnesHutSolver.js | 4 ++-- .../modules/components/physics/FA2BasedRepulsionSolver.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/network/modules/components/physics/BarnesHutSolver.js b/lib/network/modules/components/physics/BarnesHutSolver.js index 2c514e20..413ee870 100644 --- a/lib/network/modules/components/physics/BarnesHutSolver.js +++ b/lib/network/modules/components/physics/BarnesHutSolver.js @@ -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; \ No newline at end of file +export default BarnesHutSolver; diff --git a/lib/network/modules/components/physics/FA2BasedRepulsionSolver.js b/lib/network/modules/components/physics/FA2BasedRepulsionSolver.js index 24fe2742..030da003 100644 --- a/lib/network/modules/components/physics/FA2BasedRepulsionSolver.js +++ b/lib/network/modules/components/physics/FA2BasedRepulsionSolver.js @@ -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; \ No newline at end of file +export default ForceAtlas2BasedRepulsionSolver;