Browse Source

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

v3_develop
Alex de Mulder 10 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. - 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 ## 2014-11-14, version 3.7.0
### Graph2D ### 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, nodes: nodes,
edges: edges edges: edges
}; };
var options = {edges:{style:'arrow-center'}};
var options = {};
var network = new vis.Network(container, data, options); var network = new vis.Network(container, data, options);
</script> </script>
</body> </body>

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

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

Loading…
Cancel
Save