Optimize ActorTreeNode reparent when it's not collapsed but one of the parents is

This commit is contained in:
Wojtek Figat
2024-04-25 18:01:06 +02:00
parent 19cc33b200
commit 2c1b2d2b7c
2 changed files with 7 additions and 2 deletions

View File

@@ -90,6 +90,11 @@ namespace FlaxEditor.GUI.Tree
}
}
/// <summary>
/// Gets a value indicating whether the node is collapsed in the hierarchy (is collapsed or any of its parents is collapsed).
/// </summary>
public bool IsCollapsedInHierarchy => IsCollapsed || (Parent is TreeNode parentNode && parentNode.IsCollapsedInHierarchy);
/// <summary>
/// Gets or sets the text margin.
/// </summary>
@@ -1058,7 +1063,7 @@ namespace FlaxEditor.GUI.Tree
// Expand node if mouse goes over arrow
if (ArrowRect.Contains(location) && HasAnyVisibleChild)
Expand(true);
if (!_isDragOverHeader)
result = OnDragEnterHeader(data);
else

View File

@@ -97,7 +97,7 @@ namespace FlaxEditor.SceneGraph.GUI
parentTreeNode.IsLayoutLocked = false;
// Skip UI update if node won't be in a view
if (parentTreeNode.IsCollapsed)
if (parentTreeNode.IsCollapsedInHierarchy)
{
UnlockChildrenRecursive();
}