ui: Don't show children with type use edges if parent is active by default
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user