Browse Source

- dragEnd event now does not give the selected nodes if only the viewport has been dragged #453

v3_develop
Alex de Mulder 9 years ago
parent
commit
e5481cdb04
4 changed files with 2428 additions and 2406 deletions
  1. +5
    -0
      HISTORY.md
  2. +2412
    -2403
      dist/vis.js
  3. +1
    -2
      examples/network/01_basic_usage.html
  4. +10
    -1
      lib/network/Network.js

+ 5
- 0
HISTORY.md View File

@ -13,6 +13,11 @@ http://visjs.org
- Added alignZeros option to dataAxis with default value true.
### Network
- dragEnd event now does not give the selected nodes if only the viewport has been dragged #453
## 2014-11-14, version 3.7.0
### Graph2D

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


+ 1
- 2
examples/network/01_basic_usage.html View File

@ -43,9 +43,8 @@
nodes: nodes,
edges: edges
};
var options = {edges:{style:'arrow-center'}};
var options = {};
var network = new vis.Network(container, data, options);
</script>
</body>

+ 10
- 1
lib/network/Network.js View File

@ -270,6 +270,7 @@ function Network (container, data, options) {
this.startedStabilization = false;
this.stabilized = false;
this.stabilizationIterations = null;
this.draggingNodes = false;
// containers for nodes and edges
this.calculationNodes = {};
@ -858,8 +859,10 @@ Network.prototype._handleDragStart = function() {
drag.selection = [];
drag.translation = this._getTranslation();
drag.nodeId = null;
this.draggingNodes = false;
if (node != null && this.constants.dragNodes == true) {
this.draggingNodes = true;
drag.nodeId = node.id;
// select the clicked node if not yet selected
if (!node.isSelected()) {
@ -986,7 +989,13 @@ Network.prototype._handleDragEnd = function(event) {
else {
this._redraw();
}
this.emit("dragEnd",{nodeIds:this.getSelection().nodes});
if (this.draggingNodes == false) {
this.emit("dragEnd",{nodeIds:[]});
}
else {
this.emit("dragEnd",{nodeIds:this.getSelection().nodes});
}
}
/**
* handle tap/click event: select/unselect a node

Loading…
Cancel
Save