From ec8c2cc60d720865b46a134304340f04dafb8982 Mon Sep 17 00:00:00 2001 From: vasco Date: Wed, 10 Oct 2018 20:46:46 -0700 Subject: [PATCH] Fix #123 Initialize fixed nodes from f* attributes --- src/simulation.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/simulation.js b/src/simulation.js index c22fe62..b33232f 100644 --- a/src/simulation.js +++ b/src/simulation.js @@ -56,6 +56,8 @@ export default function(nodes) { function initializeNodes() { for (var i = 0, n = nodes.length, node; i < n; ++i) { node = nodes[i], node.index = i; + if (!isNaN(node.fx)) node.x = node.fx; + if (!isNaN(node.fy)) node.y = node.fy; if (isNaN(node.x) || isNaN(node.y)) { var radius = initialRadius * Math.sqrt(i), angle = i * initialAngle; node.x = radius * Math.cos(angle);