Browse Source

Merge remote-tracking branch 'origin/develop' into develop

Conflicts:
	dist/vis.js
v3_develop
jos 9 years ago
parent
commit
a636e952a5
3 changed files with 28 additions and 2 deletions
  1. +2
    -1
      HISTORY.md
  2. +1
    -1
      dist/vis.min.css
  3. +25
    -0
      lib/network/Network.js

+ 2
- 1
HISTORY.md View File

@ -16,7 +16,8 @@ http://visjs.org
- Added freezeSimulation method. - Added freezeSimulation method.
- Added clusterByZoom option. - Added clusterByZoom option.
- Fixed bug when redrawing was not right on zoomed-out browsers. - Fixed bug when redrawing was not right on zoomed-out browsers.
- Added opacity to edges. Opacity is only used for the unselected state.
- Added opacity option to edges. Opacity is only used for the unselected state.
- Fixed bug where selections from removed data elements persisted.
### DataSet/DataView ### DataSet/DataView

+ 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) { 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];

Loading…
Cancel
Save