[BUGFIX] Forcegraph delete and add nodes again on same position
This commit is contained in:
parent
b4bd941197
commit
fb857717fd
@ -1,5 +1,5 @@
|
|||||||
define(['d3-selection', 'd3-force', 'd3-zoom', 'd3-drag', 'd3-timer', 'd3-ease', 'd3-interpolate', 'helper', 'utils/math', 'forcegraph/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, helper, math, draw) {
|
function (d3Selection, d3Force, d3Zoom, d3Drag, d3Timer, d3Ease, d3Interpolate, math, draw) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
return function (config, linkScale, sidebar, router) {
|
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) {
|
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];
|
var e = dictNodes[d.node_id];
|
||||||
if (!e) {
|
if (!e) {
|
||||||
e = {};
|
e = {};
|
||||||
@ -207,10 +207,10 @@ define(['d3-selection', 'd3-force', 'd3-zoom', 'd3-drag', 'd3-timer', 'd3-ease',
|
|||||||
e.o = d;
|
e.o = d;
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
});
|
}).filter(function (e) { return e.o.is_online;});
|
||||||
|
|
||||||
intLinks = data.links.filter(function (d) {
|
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) {
|
}).map(function (d) {
|
||||||
return {
|
return {
|
||||||
o: d,
|
o: d,
|
||||||
|
Loading…
Reference in New Issue
Block a user