Add auto-expand for items list with a single category in use

This commit is contained in:
2026-09-14 06:59:52 +02:00
parent f83d853e5d
commit 09f0477e18
+12 -1
View File
@@ -52,7 +52,7 @@ namespace FlaxEditor.GUI
public float SortScore;
/// <summary>
/// Wether the query highlights should be draw.
/// Whether the query highlights should be drawn.
/// </summary>
public bool DrawHighlights = true;
@@ -261,6 +261,11 @@ namespace FlaxEditor.GUI
/// </summary>
public readonly VerticalPanel ItemsPanel;
/// <summary>
/// Gets a list of panels with item categories.
/// </summary>
public IEnumerable<DropPanel> CategoryPanels => (IEnumerable<DropPanel>)_categoryPanels ?? Array.Empty<DropPanel>();
/// <summary>
/// Initializes a new instance of the <see cref="ItemsListContextMenu"/> class.
/// </summary>
@@ -504,6 +509,12 @@ namespace FlaxEditor.GUI
category.Visible = true;
category.Close(false);
}
if (_categoryPanels.Count == 1 && items.Count == 1)
{
// Expand the only category if there are no items outside of it
_categoryPanels[0].Open(false);
}
}
_searchBox?.Clear();