ui: Don't show children with type use edges if parent is active by default

This commit is contained in:
Eberhard Graether
2018-07-13 13:16:53 +02:00
parent 151fb666e4
commit 88b507b169
3 changed files with 20 additions and 0 deletions
@@ -790,6 +790,13 @@ bool GraphController::setActive(const std::vector<Id>& activeTokenIds, bool show
edge->visible = true;
from->connected = true;
to->connected = true;
// Don't show children of active node with a type use edge to the parent
if (to->active && edge->data->isType(Edge::EDGE_TYPE_USAGE) && to->data->isParentOf(from->data))
{
from->connected = false;
to->connected = false;
}
}
else
{
+12
View File
@@ -143,6 +143,18 @@ Edge* Node::getMemberEdge() const
);
}
bool Node::isParentOf(const Node* node) const
{
while ((node = node->getParentNode()))
{
if (node == this)
{
return true;
}
}
return false;
}
Edge* Node::findEdge(std::function<bool(Edge*)> func) const
{
auto it = find_if(m_edges.begin(), m_edges.end(),
+1
View File
@@ -43,6 +43,7 @@ public:
Node* getParentNode() const;
Node* getLastParentNode();
Edge* getMemberEdge() const;
bool isParentOf(const Node* node) const;
Edge* findEdge(std::function<bool(Edge*)> func) const;
Edge* findEdgeOfType(Edge::TypeMask mask) const;