Use LayoutLock for expensive construction on large node count

This commit is contained in:
jlewin 2019-06-20 13:31:19 -07:00
parent 1b66dde24f
commit 422953d685

View file

@ -199,14 +199,19 @@ namespace MatterHackers.MatterControl.CustomWidgets
// Remove but don't close all the current nodes
content.RemoveAllChildren();
// Then add them back in (after the change)
foreach (var node in Nodes)
using (content.LayoutLock())
{
node.NodeParent = this;
node.ClearRemovedFlag();
content.AddChild(node);
// Then add them back in (after the change)
foreach (var node in Nodes)
{
node.NodeParent = this;
node.ClearRemovedFlag();
content.AddChild(node);
}
}
content.PerformLayout();
// If the node count is ending at 0 we removed content and need to rebuild the title bar so it will net have a + in it
expandWidget.Expandable = GetNodeCount(false) != 0;