|
|
@ -190,10 +190,12 @@ class InteractionHandler { |
|
|
|
let currentSelection = this.selectionHandler.getSelection(); |
|
|
|
|
|
|
|
let {nodesChanges, edgesChanges} = this._determineIfDifferent(previousSelection, currentSelection); |
|
|
|
let nodeSelected = false; |
|
|
|
|
|
|
|
if (selectedNodesCount - previouslySelectedNodeCount > 0) { // node was selected
|
|
|
|
this.selectionHandler._generateClickEvent('selectNode', event, pointer); |
|
|
|
selected = true; |
|
|
|
nodeSelected = true; |
|
|
|
} |
|
|
|
else if (selectedNodesCount - previouslySelectedNodeCount < 0) { // node was deselected
|
|
|
|
this.selectionHandler._generateClickEvent('deselectNode', event, pointer, previousSelection); |
|
|
@ -202,22 +204,26 @@ class InteractionHandler { |
|
|
|
else if (selectedNodesCount === previouslySelectedNodeCount && nodesChanges === true) { |
|
|
|
this.selectionHandler._generateClickEvent('deselectNode', event, pointer, previousSelection); |
|
|
|
this.selectionHandler._generateClickEvent('selectNode', event, pointer); |
|
|
|
nodeSelected = true; |
|
|
|
selected = true; |
|
|
|
} |
|
|
|
|
|
|
|
if (selectedEdgesCount - previouslySelectedEdgeCount < 0 || (selectedEdgesCount === previouslySelectedEdgeCount && edgesChanges === true)) { // edge was deselected
|
|
|
|
this.selectionHandler._generateClickEvent('deselectEdge', event, pointer, previousSelection); |
|
|
|
selected = true; |
|
|
|
// handle the selected edges
|
|
|
|
if (selectedEdgesCount - previouslySelectedEdgeCount > 0 && nodeSelected === false) { // edge was selected
|
|
|
|
this.selectionHandler._generateClickEvent('selectEdge', event, pointer); |
|
|
|
selected = true; |
|
|
|
} |
|
|
|
|
|
|
|
// Check if the user clicked on an edge
|
|
|
|
let selectedNode = this.selectionHandler._getSelectedNode(); |
|
|
|
let selectedEdge = this.selectionHandler._getSelectedEdge(); |
|
|
|
if (selectedNode === undefined && selectedEdge !== undefined) { |
|
|
|
else if (selectedEdgesCount - previouslySelectedEdgeCount < 0) { // 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); |
|
|
|
this.selectionHandler._generateClickEvent('selectEdge', event, pointer); |
|
|
|
selected = true; |
|
|
|
} |
|
|
|
|
|
|
|
// fire the select event if anything has been selected or deselected
|
|
|
|
if (selected === true) { // select or unselect
|
|
|
|
this.selectionHandler._generateClickEvent('select', event, pointer); |
|
|
|
} |
|
|
|