From 253e52a9483945e901f9267989faa44006d1b2a0 Mon Sep 17 00:00:00 2001 From: wimrijnders Date: Fri, 28 Apr 2017 07:02:08 +0200 Subject: [PATCH] Fix #2994: select edge with id zero (#2996) --- lib/network/modules/SelectionHandler.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/network/modules/SelectionHandler.js b/lib/network/modules/SelectionHandler.js index 121a2e93..101b9f4a 100644 --- a/lib/network/modules/SelectionHandler.js +++ b/lib/network/modules/SelectionHandler.js @@ -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; \ No newline at end of file +export default SelectionHandler;