Browse Source

Fix #2994: select edge with id zero (#2996)

gemini
wimrijnders 7 years ago
committed by yotamberk
parent
commit
253e52a948
1 changed files with 6 additions and 7 deletions
  1. +6
    -7
      lib/network/modules/SelectionHandler.js

+ 6
- 7
lib/network/modules/SelectionHandler.js View File

@ -156,7 +156,7 @@ class SelectionHandler {
/**
* Get the top node at the a specific point (like a click)
* Get the top node at the passed point (like a click)
*
* @param {{x: Number, y: Number}} pointer
* @return {Node | undefined} node
@ -212,11 +212,10 @@ class SelectionHandler {
/**
* Place holder. To implement change the getNodeAt to a _getObjectAt. Have the _getObjectAt call
* getNodeAt and _getEdgesAt, then priortize the selection to user preferences.
* Get the edges nearest to the passed point (like a click)
*
* @param pointer
* @returns {undefined}
* @param {{x: Number, y: Number}} pointer
* @return {Edge | undefined} node
*/
getEdgeAt(pointer, returnEdge = true) {
// Iterate over edges, pick closest within 10
@ -239,7 +238,7 @@ class SelectionHandler {
}
}
}
if (overlappingEdge) {
if (overlappingEdge !== null) {
if (returnEdge === true) {
return this.body.edges[overlappingEdge];
}
@ -706,4 +705,4 @@ class SelectionHandler {
}
}
export default SelectionHandler;
export default SelectionHandler;

Loading…
Cancel
Save