Browse Source

Merge pull request #1153 from JonathanGeoffroy/issue#1144-selectEdge

fix : selectEdge was fired even if user clicked on a node
kamadaKawai
Alex 9 years ago
parent
commit
a2bf879781
1 changed files with 8 additions and 10 deletions
  1. +8
    -10
      lib/network/modules/InteractionHandler.js

+ 8
- 10
lib/network/modules/InteractionHandler.js View File

@ -205,21 +205,19 @@ class InteractionHandler {
selected = true; selected = true;
} }
if (selectedEdgesCount - previouslySelectedEdgeCount > 0) { // edge was selected
this.selectionHandler._generateClickEvent('selectEdge', event, pointer);
selected = true;
}
else if (selectedEdgesCount - previouslySelectedEdgeCount < 0) { // edge was deselected
this.selectionHandler._generateClickEvent('deselectEdge', event, pointer, previousSelection);
selected = true;
if (selectedEdgesCount - previouslySelectedEdgeCount < 0 || (selectedEdgesCount === previouslySelectedEdgeCount && edgesChanges === true)) { // edge was deselected
this.selectionHandler._generateClickEvent('deselectEdge', event, pointer, previousSelection);
selected = true;
} }
else if (selectedEdgesCount === previouslySelectedEdgeCount && edgesChanges === true) {
this.selectionHandler._generateClickEvent('deselectEdge', event, pointer, previousSelection);
// Check if the user clicked on an edge
let selectedNode = this.selectionHandler._getSelectedNode();
let selectedEdge = this.selectionHandler._getSelectedEdge();
if (selectedNode === undefined && selectedEdge !== undefined) {
this.selectionHandler._generateClickEvent('selectEdge', event, pointer); this.selectionHandler._generateClickEvent('selectEdge', event, pointer);
selected = true; selected = true;
} }
if (selected === true) { // select or unselect if (selected === true) { // select or unselect
this.selectionHandler._generateClickEvent('select', event, pointer); this.selectionHandler._generateClickEvent('select', event, pointer);
} }

Loading…
Cancel
Save