diff --git a/src/lib/component/controller/GraphController.cpp b/src/lib/component/controller/GraphController.cpp index b3341695..c74b7570 100644 --- a/src/lib/component/controller/GraphController.cpp +++ b/src/lib/component/controller/GraphController.cpp @@ -43,7 +43,7 @@ void GraphController::handleMessage(MessageActivateAll* message) if (message->acceptedNodeTypes != NodeTypeSet::all()) { createDummyGraphAndSetActiveAndVisibility( - std::vector(), m_storageAccess->getGraphForNodeTypes(message->acceptedNodeTypes) + std::vector(), m_storageAccess->getGraphForNodeTypes(message->acceptedNodeTypes), false ); addCharacterIndex(); @@ -52,7 +52,7 @@ void GraphController::handleMessage(MessageActivateAll* message) } else { - createDummyGraphAndSetActiveAndVisibility(std::vector(), m_storageAccess->getGraphForAll()); + createDummyGraphAndSetActiveAndVisibility(std::vector(), m_storageAccess->getGraphForAll(), false); bundleNodesByType(); @@ -104,7 +104,7 @@ void GraphController::handleMessage(MessageActivateTokens* message) bool isNamespace = false; std::shared_ptr graph = m_storageAccess->getGraphForActiveTokenIds(tokenIds, getExpandedNodeIds(), &isNamespace); - createDummyGraphAndSetActiveAndVisibility(tokenIds, graph); + createDummyGraphAndSetActiveAndVisibility(tokenIds, graph, !message->isFromSearch); if (isNamespace) { @@ -581,16 +581,25 @@ void GraphController::createDummyGraph(const std::shared_ptr graph) } void GraphController::createDummyGraphAndSetActiveAndVisibility( - const std::vector& tokenIds, const std::shared_ptr graph + const std::vector& tokenIds, const std::shared_ptr graph, bool keepExpandedNodesExpanded ){ - std::vector expandedNodeIds = getExpandedNodeIds(); + std::vector expandedNodeIds; + + if (keepExpandedNodesExpanded) + { + expandedNodeIds = getExpandedNodeIds(); + } createDummyGraph(graph); bool noActive = setActive(tokenIds, false); autoExpandActiveNode(tokenIds); - setExpandedNodeIds(expandedNodeIds); + + if (keepExpandedNodesExpanded) + { + setExpandedNodeIds(expandedNodeIds); + } setVisibility(noActive); diff --git a/src/lib/component/controller/GraphController.h b/src/lib/component/controller/GraphController.h index fa31e15b..f67b3da6 100644 --- a/src/lib/component/controller/GraphController.h +++ b/src/lib/component/controller/GraphController.h @@ -75,7 +75,7 @@ private: void createDummyGraph(const std::shared_ptr graph); void createDummyGraphAndSetActiveAndVisibility( - const std::vector& tokenIds, const std::shared_ptr graph); + const std::vector& tokenIds, const std::shared_ptr graph, bool keepExpandedNodesExpanded); std::vector> createDummyNodeTopDown(Node* node, Id ancestorId); std::vector getExpandedNodeIds() const;