[BUGFIX] Forcegraph delete and add nodes again on same position

This commit is contained in:
Geno 2017-10-29 19:04:02 +01:00 committed by Xaver Maierhofer
parent b4bd941197
commit fb857717fd

View File

@ -1,5 +1,5 @@
define(['d3-selection', 'd3-force', 'd3-zoom', 'd3-drag', 'd3-timer', 'd3-ease', 'd3-interpolate', 'helper', 'utils/math', 'forcegraph/draw'],
function (d3Selection, d3Force, d3Zoom, d3Drag, d3Timer, d3Ease, d3Interpolate, helper, math, draw) {
define(['d3-selection', 'd3-force', 'd3-zoom', 'd3-drag', 'd3-timer', 'd3-ease', 'd3-interpolate', 'utils/math', 'forcegraph/draw'],
function (d3Selection, d3Force, d3Zoom, d3Drag, d3Timer, d3Ease, d3Interpolate, math, draw) {
'use strict';
return function (config, linkScale, sidebar, router) {
@ -197,7 +197,7 @@ define(['d3-selection', 'd3-force', 'd3-zoom', 'd3-drag', 'd3-timer', 'd3-ease',
});
self.setData = function setData(data) {
intNodes = data.nodes.all.filter(helper.online).map(function (d) {
intNodes = data.nodes.all.map(function (d) {
var e = dictNodes[d.node_id];
if (!e) {
e = {};
@ -207,10 +207,10 @@ define(['d3-selection', 'd3-force', 'd3-zoom', 'd3-drag', 'd3-timer', 'd3-ease',
e.o = d;
return e;
});
}).filter(function (e) { return e.o.is_online;});
intLinks = data.links.filter(function (d) {
return dictNodes[d.source.node_id] && dictNodes[d.target.node_id];
return dictNodes[d.source.node_id].o.is_online && dictNodes[d.target.node_id].o.is_online;
}).map(function (d) {
return {
o: d,