Browse Source

made deselect and select nodes and edges fire more consistently

flowchartTest
Alex de Mulder 9 years ago
parent
commit
fab3215f2f
3 changed files with 1019 additions and 1007 deletions
  1. +1011
    -1005
      dist/vis.js
  2. +2
    -2
      examples/network/events/interactionEvents.html
  3. +6
    -0
      lib/network/modules/InteractionHandler.js

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


+ 2
- 2
examples/network/events/interactionEvents.html View File

@ -80,8 +80,8 @@
network.on("showPopup", function (params) {
document.getElementById('eventSpan').innerHTML = '<h2>showPopup event: </h2>' + JSON.stringify(params, null, 4);
});
network.on("hidePopup", function (params) {
console.log('hidePopup Event:', params);
network.on("hidePopup", function () {
console.log('hidePopup Event');
});
network.on("select", function (params) {
console.log('select Event:', params);

+ 6
- 0
lib/network/modules/InteractionHandler.js View File

@ -191,6 +191,9 @@ class InteractionHandler {
let {nodesChanges, edgesChanges} = this._determineIfDifferent(previousSelection, currentSelection);
if (selectedNodesCount - previouslySelectedNodeCount > 0 || (selectedNodesCount === previouslySelectedNodeCount && nodesChanges === true)) { // node was selected
if (selectedNodesCount === previouslySelectedNodeCount && nodesChanges === true) {
this.selectionHandler._generateClickEvent('deselectNode', event, pointer, previousSelection);
}
this.selectionHandler._generateClickEvent('selectNode', event, pointer);
selected = true;
}
@ -200,6 +203,9 @@ class InteractionHandler {
}
if (selectedEdgesCount - previouslySelectedEdgeCount > 0|| (selectedEdgesCount === previouslySelectedEdgeCount && edgesChanges === true)) { // node was selected
if (selectedEdgesCount === previouslySelectedEdgeCount && edgesChanges === true) {
this.selectionHandler._generateClickEvent('deselectEdge', event, pointer, previousSelection);
}
this.selectionHandler._generateClickEvent('selectEdge', event, pointer);
selected = true;
}

Loading…
Cancel
Save