Browse Source

removed nodes and edges from the selection before they are deleted through the dataset or when setData is called.

v3_develop
Alex de Mulder 10 years ago
parent
commit
ff4d576b7c
3 changed files with 25037 additions and 24988 deletions
  1. +25011
    -24987
      dist/vis.js
  2. +1
    -1
      dist/vis.min.css
  3. +25
    -0
      lib/network/Network.js

+ 25011
- 24987
dist/vis.js
File diff suppressed because it is too large
View File


+ 1
- 1
dist/vis.min.css
File diff suppressed because it is too large
View File


+ 25
- 0
lib/network/Network.js View File

@ -603,6 +603,10 @@ Network.prototype.setData = function(data, disableStart) {
if (disableStart === undefined) {
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.
this.initializing = true;
@ -1684,10 +1688,22 @@ Network.prototype._markAllEdgesAsDirty = function() {
*/
Network.prototype._removeNodes = function(ids) {
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++) {
var id = ids[i];
delete nodes[id];
}
this._updateNodeIndexList();
if (this.constants.hierarchicalLayout.enabled == true && this.initializing == false) {
this._resetLevels();
@ -1819,6 +1835,15 @@ Network.prototype._updateEdges = function (ids) {
*/
Network.prototype._removeEdges = function (ids) {
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++) {
var id = ids[i];
var edge = edges[id];

Loading…
Cancel
Save