Browse Source

added dragStart and dragEnd events

v3_develop
Alex de Mulder 10 years ago
parent
commit
27c8c841e0
4 changed files with 2265 additions and 2244 deletions
  1. +1
    -0
      HISTORY.md
  2. +2244
    -2243
      dist/vis.js
  3. +18
    -0
      docs/network.html
  4. +2
    -1
      lib/network/Network.js

+ 1
- 0
HISTORY.md View File

@ -7,6 +7,7 @@ http://visjs.org
### Network
- Fixed nodes not always being unfixed when using allowedToMove.
- Added dragStart and dragEnd events.
### Graph2d

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


+ 18
- 0
docs/network.html View File

@ -2423,6 +2423,24 @@ network.off('select', onSelect);
</ul>
</td>
</tr>
<tr>
<td>dragStart</td>
<td>Fired when a node is being dragged.</td>
<td>
<ul>
<li><code>nodeIds</code>: Array of ids of the nodes that are being dragged</li>
</ul>
</td>
</tr>
<tr>
<td>dragEnd</td>
<td>Fired when the dragging of a node(s) has ended.</td>
<td>
<ul>
<li><code>nodeIds</code>: Array of ids of the nodes that were being dragged</li>
</ul>
</td>
</tr>
<tr>
<td>stabilized</td>
<td>Fired every time the network has been stabilized. This event can be used to trigger the .storePosition() function after stabilization. Fired with an object having the following properties:</td>

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

@ -852,7 +852,7 @@ Network.prototype._handleDragStart = function() {
if (!node.isSelected()) {
this._selectObject(node,false);
}
this.emit("dragStart",{nodeIds:this.getSelection().nodes});
// create an array with the selected nodes and their original location and status
for (var objectId in this.selectionObj.nodes) {
if (this.selectionObj.nodes.hasOwnProperty(objectId)) {
@ -952,6 +952,7 @@ Network.prototype._handleOnDrag = function(event) {
* @private
*/
Network.prototype._onDragEnd = function () {
this.emit("dragEnd",{nodeIds:this.getSelection().nodes});
this.drag.dragging = false;
var selection = this.drag.selection;
if (selection && selection.length) {

Loading…
Cancel
Save