Merge branch 'SimplifyListCtrlScrolling' of https://github.com/xxSeys1/FlaxEngine into xxSeys1-SimplifyListCtrlScrolling

This commit is contained in:
Wojtek Figat
2025-08-22 22:34:05 +02:00

View File

@@ -514,20 +514,15 @@ namespace FlaxEditor.GUI
var items = ItemsPanel.Children; var items = ItemsPanel.Children;
for (int i = 0; i < items.Count; i++) for (int i = 0; i < items.Count; i++)
{ {
if (items[i] is Item item && item.Visible) var currentItem = items[i];
if (currentItem is Item item && item.Visible)
result.Add(item); result.Add(item);
} else if (currentItem is DropPanel category && (!ignoreFoldedCategories || !category.IsClosed) && currentItem.Visible)
if (_categoryPanels != null)
{
for (int i = 0; i < _categoryPanels.Count; i++)
{ {
var category = _categoryPanels[i];
if (!category.Visible || (ignoreFoldedCategories && category is DropPanel panel && panel.IsClosed))
continue;
for (int j = 0; j < category.Children.Count; j++) for (int j = 0; j < category.Children.Count; j++)
{ {
if (category.Children[j] is Item item2 && item2.Visible) if (category.Children[j] is Item categoryItem && categoryItem.Visible)
result.Add(item2); result.Add(categoryItem);
} }
} }
} }
@@ -591,10 +586,6 @@ namespace FlaxEditor.GUI
var items = GetVisibleItems(!controlDown); var items = GetVisibleItems(!controlDown);
var focusedIndex = items.IndexOf(focusedItem); var focusedIndex = items.IndexOf(focusedItem);
// If the user hasn't selected anything yet and is holding control, focus first folded item
if (focusedIndex == -1 && controlDown)
focusedIndex = GetVisibleItems(true).Count - 1;
int delta = key == KeyboardKeys.ArrowDown ? -1 : 1; int delta = key == KeyboardKeys.ArrowDown ? -1 : 1;
int nextIndex = Mathf.Wrap(focusedIndex - delta, 0, items.Count - 1); int nextIndex = Mathf.Wrap(focusedIndex - delta, 0, items.Count - 1);
var nextItem = items[nextIndex]; var nextItem = items[nextIndex];