forcegraph: calculate linksDict/nodesDict indepently of d3

This commit is contained in:
Nils Schneider 2015-04-10 15:19:42 +02:00
parent 9bdb7c562a
commit eb735c8c52

View file

@ -343,13 +343,22 @@ define(["d3"], function (d3) {
return e
})
linksDict = {}
nodesDict = {}
intNodes.forEach(function (d) {
d.neighbours = {}
if (d.o.node)
nodesDict[d.o.node.nodeinfo.node_id] = d
})
intLinks.forEach(function (d) {
d.source.neighbours[d.target.o.id] = d.target
d.target.neighbours[d.source.o.id] = d.source
if (d.o.source.node && d.o.target.node)
linksDict[d.o.id] = d
})
intNodes.forEach(function (d) {
@ -362,20 +371,6 @@ define(["d3"], function (d3) {
node = updateNodes(visNodes, intNodes)
label = updateLabels(visLabels, intNodes)
linksDict = {}
link.each( function (d) {
if (d.o.source.node && d.o.target.node)
linksDict[d.o.id] = d
})
nodesDict = {}
node.each( function (d) {
if (d.o.node)
nodesDict[d.o.node.nodeinfo.node_id] = d
})
if (localStorageTest()) {
var save = JSON.parse(localStorage.getItem("graph/nodeposition"))