From 43ac76d38cdf802d2d9354e5ee58a95f8c1f5c33 Mon Sep 17 00:00:00 2001 From: Eberhard Graether Date: Mon, 22 Feb 2016 20:51:58 +0100 Subject: [PATCH] logic: Only activate node when clicking locations of both nodes and edges --- src/lib/data/Storage.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/lib/data/Storage.cpp b/src/lib/data/Storage.cpp index 1203fd77..e641ad73 100644 --- a/src/lib/data/Storage.cpp +++ b/src/lib/data/Storage.cpp @@ -866,6 +866,7 @@ std::vector Storage::getActiveTokenIdsForId(Id tokenId, Id* declarationId) c std::vector Storage::getNodeIdsForLocationIds(const std::vector& locationIds) const { std::set nodeIds; + std::set edgeIds; for (Id locationId : locationIds) { @@ -874,7 +875,7 @@ std::vector Storage::getNodeIdsForLocationIds(const std::vector& locatio StorageEdge edge = m_sqliteStorage.getEdgeById(elementId); if (edge.id != 0) // here we test if location is an edge. { - nodeIds.insert(edge.targetNodeId); + edgeIds.insert(edge.targetNodeId); } else { @@ -882,7 +883,12 @@ std::vector Storage::getNodeIdsForLocationIds(const std::vector& locatio } } - return utility::toVector(nodeIds); + if (nodeIds.size()) + { + return utility::toVector(nodeIds); + } + + return utility::toVector(edgeIds); } std::vector Storage::getTokenIdsForMatches(const std::vector& matches) const