|
@ -603,6 +603,10 @@ Network.prototype.setData = function(data, disableStart) { |
|
|
if (disableStart === undefined) { |
|
|
if (disableStart === undefined) { |
|
|
disableStart = false; |
|
|
disableStart = false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// unselect all to ensure no selections from old data are carried over.
|
|
|
|
|
|
this._unselectAll(true); |
|
|
|
|
|
|
|
|
// we set initializing to true to ensure that the hierarchical layout is not performed until both nodes and edges are added.
|
|
|
// we set initializing to true to ensure that the hierarchical layout is not performed until both nodes and edges are added.
|
|
|
this.initializing = true; |
|
|
this.initializing = true; |
|
|
|
|
|
|
|
@ -1684,10 +1688,22 @@ Network.prototype._markAllEdgesAsDirty = function() { |
|
|
*/ |
|
|
*/ |
|
|
Network.prototype._removeNodes = function(ids) { |
|
|
Network.prototype._removeNodes = function(ids) { |
|
|
var nodes = this.nodes; |
|
|
var nodes = this.nodes; |
|
|
|
|
|
|
|
|
|
|
|
// remove from selection
|
|
|
|
|
|
for (var i = 0, len = ids.length; i < len; i++) { |
|
|
|
|
|
if (this.selectionObj.nodes[ids[i]] !== undefined) { |
|
|
|
|
|
this.nodes[ids[i]].unselect(); |
|
|
|
|
|
this._removeFromSelection(this.nodes[ids[i]]); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
for (var i = 0, len = ids.length; i < len; i++) { |
|
|
for (var i = 0, len = ids.length; i < len; i++) { |
|
|
var id = ids[i]; |
|
|
var id = ids[i]; |
|
|
delete nodes[id]; |
|
|
delete nodes[id]; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this._updateNodeIndexList(); |
|
|
this._updateNodeIndexList(); |
|
|
if (this.constants.hierarchicalLayout.enabled == true && this.initializing == false) { |
|
|
if (this.constants.hierarchicalLayout.enabled == true && this.initializing == false) { |
|
|
this._resetLevels(); |
|
|
this._resetLevels(); |
|
@ -1819,6 +1835,15 @@ Network.prototype._updateEdges = function (ids) { |
|
|
*/ |
|
|
*/ |
|
|
Network.prototype._removeEdges = function (ids) { |
|
|
Network.prototype._removeEdges = function (ids) { |
|
|
var edges = this.edges; |
|
|
var edges = this.edges; |
|
|
|
|
|
|
|
|
|
|
|
// remove from selection
|
|
|
|
|
|
for (var i = 0, len = ids.length; i < len; i++) { |
|
|
|
|
|
if (this.selectionObj.edges[ids[i]] !== undefined) { |
|
|
|
|
|
edges[ids[i]].unselect(); |
|
|
|
|
|
this._removeFromSelection(edges[ids[i]]); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
for (var i = 0, len = ids.length; i < len; i++) { |
|
|
for (var i = 0, len = ids.length; i < len; i++) { |
|
|
var id = ids[i]; |
|
|
var id = ids[i]; |
|
|
var edge = edges[id]; |
|
|
var edge = edges[id]; |
|
|