diff --git a/src/link.js b/src/link.js index d9002ad..4d7e81e 100644 --- a/src/link.js +++ b/src/link.js @@ -15,6 +15,7 @@ export default function() { nodes, stableVelocity = 0, stableVeloHandler = null, + latestVelocityDiff = 0, iterations = 1; function force(alpha) { @@ -54,6 +55,7 @@ export default function() { velocityDiff += Math.abs(Math.hypot(node.vx-node.oldvx, node.vy-node.oldvy)); } velocityDiff /= n*(n-1); + latestVelocityDiff = velocityDiff; if(velocityDiff= 1; j++) { + let sumLowDDistSq = 0; + for (let j = nodes.length-1; j >= 1; j--) { for (let i = 0; i < j; i++) { let source = nodes[i], target = nodes[j]; let lowDDist = Math.hypot(target.x - source.x, target.y - source.y);