From 03a6d45822bc493ab9ab06f0bda246893a5e0acf Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Tue, 20 Dec 2016 01:47:41 -0500 Subject: [PATCH] refactor and kill dupe code --- frontend/src/Metamaps/Visualize.js | 37 +----------------------------- 1 file changed, 1 insertion(+), 36 deletions(-) diff --git a/frontend/src/Metamaps/Visualize.js b/frontend/src/Metamaps/Visualize.js index 577c5418..dc02663b 100644 --- a/frontend/src/Metamaps/Visualize.js +++ b/frontend/src/Metamaps/Visualize.js @@ -48,28 +48,9 @@ const Visualize = { computePositions: function() { const self = Visualize + JIT.connectModelsToGraph() if (self.type === 'RGraph') { - let i - let l - self.mGraph.graph.eachNode(function(n) { - const topic = DataModel.Topics.get(n.id) - topic.set({ node: n }, { silent: true }) - topic.updateNode() - - n.eachAdjacency(function(edge) { - if (!edge.getData('init')) { - edge.setData('init', true) - - l = edge.getData('synapseIDs').length - for (i = 0; i < l; i++) { - const synapse = DataModel.Synapses.get(edge.getData('synapseIDs')[i]) - synapse.set({ edge: edge }, { silent: true }) - synapse.updateEdge() - } - } - }) - var pos = n.getPos() pos.setc(-200, -200) }) @@ -77,23 +58,7 @@ const Visualize = { } else if (self.type === 'ForceDirected') { self.mGraph.graph.eachNode(function(n) { const topic = DataModel.Topics.get(n.id) - topic.set({ node: n }, { silent: true }) - topic.updateNode() const mapping = topic.getMapping() - - n.eachAdjacency(function(edge) { - if (!edge.getData('init')) { - edge.setData('init', true) - - const l = edge.getData('synapseIDs').length - for (let i = 0; i < l; i++) { - const synapse = DataModel.Synapses.get(edge.getData('synapseIDs')[i]) - synapse.set({ edge: edge }, { silent: true }) - synapse.updateEdge() - } - } - }) - const startPos = new $jit.Complex(0, 0) const endPos = new $jit.Complex(mapping.get('xloc'), mapping.get('yloc')) n.setPos(startPos, 'start')