From d448fa47acb1c90f4f6f9b64fdfc858fe83ec0f9 Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Mon, 1 Jul 2019 16:24:46 +0000 Subject: [PATCH] Revert "Switch back to local weighting, so we can do direction weights" This reverts commit e284b76718ce8c010f8c93d2711fcdf6f57d123f. --- architype.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/architype.js b/architype.js index f9d7d52..f15d3c3 100644 --- a/architype.js +++ b/architype.js @@ -420,10 +420,9 @@ class Architype { iterate(graph) { this.sortByMostTension(graph.nodes); + let newPos = null; + let newTension = this.getTotalTension(graph.nodes); for (let node of graph.nodes) { - let newPos = null; - let newTension = node.tension; - let origPos = node.pos; let offsets = new Map(); let addOffset = (x, y) => { @@ -440,8 +439,9 @@ class Architype { if (graph.nodesByPos.has(testPos.toString())) { continue; } - let testVec = this.findVec(testPos, node.affinity); - let testTension = this.findTension(testVec); + node.pos = testPos; + let testTension = this.getTotalTension(graph.nodes); + node.pos = origPos; if (testTension < newTension) { newPos = testPos; newTension = testTension;