simplify and fix edge case in item list scrolling while holding control
This commit is contained in:
@@ -514,19 +514,14 @@ 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 item = items[i];
|
||||||
result.Add(item);
|
if (item is Item item1 && item1.Visible)
|
||||||
}
|
result.Add(item1);
|
||||||
if (_categoryPanels != null)
|
else if (!ignoreFoldedCategories && item is DropPanel panel && item.Visible)
|
||||||
{
|
|
||||||
for (int i = 0; i < _categoryPanels.Count; i++)
|
|
||||||
{
|
{
|
||||||
var category = _categoryPanels[i];
|
for (int j = 0; j < panel.Children.Count; j++)
|
||||||
if (!category.Visible || (ignoreFoldedCategories && category is DropPanel panel && panel.IsClosed))
|
|
||||||
continue;
|
|
||||||
for (int j = 0; j < category.Children.Count; j++)
|
|
||||||
{
|
{
|
||||||
if (category.Children[j] is Item item2 && item2.Visible)
|
if (panel.Children[j] is Item item2 && item2.Visible)
|
||||||
result.Add(item2);
|
result.Add(item2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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];
|
||||||
|
|||||||
Reference in New Issue
Block a user