allow the user to unfold folded categories when scrolling with keyboard

This commit is contained in:
xxSeys1
2025-06-16 14:10:44 +02:00
parent 3c74b315a8
commit cd7233d559

View File

@@ -227,9 +227,8 @@ namespace FlaxEditor.GUI
{ {
int order = -1 * SortScore.CompareTo(otherItem.SortScore); int order = -1 * SortScore.CompareTo(otherItem.SortScore);
if (order == 0) if (order == 0)
{
order = string.Compare(Name, otherItem.Name, StringComparison.Ordinal); order = string.Compare(Name, otherItem.Name, StringComparison.Ordinal);
}
return order; return order;
} }
return base.Compare(other); return base.Compare(other);
@@ -535,6 +534,12 @@ namespace FlaxEditor.GUI
return result; return result;
} }
private void ExpandToItem(Item item)
{
if (item.Parent is DropPanel dropPanel)
dropPanel.Open(false);
}
/// <inheritdoc /> /// <inheritdoc />
protected override void OnShow() protected override void OnShow()
{ {
@@ -564,7 +569,7 @@ namespace FlaxEditor.GUI
Hide(); Hide();
return true; return true;
case KeyboardKeys.Backspace: case KeyboardKeys.Backspace:
// Alow the user to quickly focus the searchbar // Allow the user to quickly focus the searchbar
if (_searchBox != null && !_searchBox.IsFocused) if (_searchBox != null && !_searchBox.IsFocused)
{ {
_searchBox.Focus(); _searchBox.Focus();
@@ -590,6 +595,11 @@ namespace FlaxEditor.GUI
// Focus the next item // Focus the next item
nextItem.Focus(); nextItem.Focus();
// Allow the user to expand groups while scrolling
if (Root.GetKey(KeyboardKeys.Control))
ExpandToItem(nextItem);
_scrollPanel.ScrollViewTo(nextItem); _scrollPanel.ScrollViewTo(nextItem);
return true; return true;
case KeyboardKeys.Return: case KeyboardKeys.Return: