From 4682c15a606573fbc815c43c8bc5f33bfd7782f8 Mon Sep 17 00:00:00 2001 From: Pitchaya Boonsarngsuk <2285135b@student.gla.ac.uk> Date: Tue, 6 Feb 2018 13:30:13 +0000 Subject: [PATCH] Link add API --- src/link.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/link.js b/src/link.js index 5773c82..cd979f2 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