logic: Fixed graph nodes restoring their expand state

bug id = 118
This commit is contained in:
Eberhard Graether
2016-08-09 15:32:14 +02:00
parent b9f518feed
commit 9cda1e773d
3 changed files with 16 additions and 9 deletions
@@ -139,6 +139,11 @@ void GraphController::handleMessage(MessageGraphNodeBundleSplit* message)
void GraphController::handleMessage(MessageGraphNodeExpand* message)
{
if (message->ignoreIfNotReplayed && !message->isReplayed())
{
return;
}
DummyNode* node = getDummyGraphNodeById(message->tokenId);
if (node)
{
@@ -332,7 +337,8 @@ std::vector<Id> GraphController::getExpandedNodeIds() const
for (std::pair<Id, std::shared_ptr<DummyNode>> p : m_dummyGraphNodes)
{
DummyNode* oldNode = p.second.get();
if (oldNode->expanded && oldNode->isGraphNode() && !oldNode->data->isType(Node::NODE_FUNCTION | Node::NODE_METHOD))
if (oldNode->expanded && !oldNode->autoExpanded && oldNode->isGraphNode() &&
!oldNode->data->isType(Node::NODE_FUNCTION | Node::NODE_METHOD))
{
nodeIds.push_back(p.first);
}
@@ -345,14 +351,10 @@ void GraphController::setExpandedNodeIds(const std::vector<Id>& nodeIds)
for (Id id : nodeIds)
{
DummyNode* node = getDummyGraphNodeById(id);
if (node && node->topLevelAncestorId)
if (node)
{
DummyNode* parent = getDummyGraphNodeById(node->topLevelAncestorId);
if (parent && parent->hasActiveSubNode())
{
node->expanded = true;
}
node->expanded = true;
MessageGraphNodeExpand(id, true, true);
}
}
}
@@ -368,6 +370,7 @@ void GraphController::autoExpandActiveNode(const std::vector<Id>& activeTokenIds
if (node)
{
node->expanded = true;
node->autoExpanded = true;
}
}
@@ -40,6 +40,7 @@ public:
, active(false)
, connected(false)
, expanded(false)
, autoExpanded(false)
, hasParent(true)
, accessKind(ACCESS_NONE)
, invisibleSubNodeCount(0)
@@ -236,6 +237,7 @@ public:
bool active;
bool connected;
bool expanded;
bool autoExpanded;
bool hasParent;
// AccessNode
@@ -8,9 +8,10 @@ class MessageGraphNodeExpand
: public Message<MessageGraphNodeExpand>
{
public:
MessageGraphNodeExpand(Id tokenId, bool expand)
MessageGraphNodeExpand(Id tokenId, bool expand, bool ignoreIfNotReplayed = false)
: tokenId(tokenId)
, expand(expand)
, ignoreIfNotReplayed(ignoreIfNotReplayed)
{
}
@@ -34,6 +35,7 @@ public:
const Id tokenId;
const bool expand;
const bool ignoreIfNotReplayed;
};
#endif // MESSAGE_GRAPH_NODE_EXPAND_H