From cd7233d559dded4da4ec88e5d6f498e18de22ff8 Mon Sep 17 00:00:00 2001 From: xxSeys1 Date: Mon, 16 Jun 2025 14:10:44 +0200 Subject: [PATCH] allow the user to unfold folded categories when scrolling with keyboard --- Source/Editor/GUI/ItemsListContextMenu.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Source/Editor/GUI/ItemsListContextMenu.cs b/Source/Editor/GUI/ItemsListContextMenu.cs index 58f8c2eb4..0f138fb80 100644 --- a/Source/Editor/GUI/ItemsListContextMenu.cs +++ b/Source/Editor/GUI/ItemsListContextMenu.cs @@ -227,9 +227,8 @@ namespace FlaxEditor.GUI { int order = -1 * SortScore.CompareTo(otherItem.SortScore); if (order == 0) - { order = string.Compare(Name, otherItem.Name, StringComparison.Ordinal); - } + return order; } return base.Compare(other); @@ -535,6 +534,12 @@ namespace FlaxEditor.GUI return result; } + private void ExpandToItem(Item item) + { + if (item.Parent is DropPanel dropPanel) + dropPanel.Open(false); + } + /// protected override void OnShow() { @@ -564,7 +569,7 @@ namespace FlaxEditor.GUI Hide(); return true; case KeyboardKeys.Backspace: - // Alow the user to quickly focus the searchbar + // Allow the user to quickly focus the searchbar if (_searchBox != null && !_searchBox.IsFocused) { _searchBox.Focus(); @@ -590,6 +595,11 @@ namespace FlaxEditor.GUI // Focus the next item nextItem.Focus(); + + // Allow the user to expand groups while scrolling + if (Root.GetKey(KeyboardKeys.Control)) + ExpandToItem(nextItem); + _scrollPanel.ScrollViewTo(nextItem); return true; case KeyboardKeys.Return: