Fix sorting items in various contextual list popups in Editor
This commit is contained in:
@@ -273,7 +273,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
cm.AddItem(item);
|
||||
}
|
||||
cm.ItemClicked += item => action((string)item.Tag);
|
||||
cm.SortChildren();
|
||||
cm.SortItems();
|
||||
cm.Show(button.Parent, button.BottomLeft);
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
cm.AddItem(new TypeSearchPopup.TypeItemView(scripts[i]));
|
||||
}
|
||||
cm.ItemClicked += item => AddScript((ScriptType)item.Tag);
|
||||
cm.SortChildren();
|
||||
cm.SortItems();
|
||||
cm.Show(this, button.BottomLeft);
|
||||
}
|
||||
|
||||
|
||||
@@ -642,7 +642,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
cm.AddItem(new TypeSearchPopup.TypeItemView(controlTypes[i]));
|
||||
}
|
||||
cm.ItemClicked += controlType => SetType((ScriptType)controlType.Tag);
|
||||
cm.SortChildren();
|
||||
cm.SortItems();
|
||||
cm.Show(button.Parent, button.BottomLeft);
|
||||
}
|
||||
|
||||
|
||||
@@ -263,6 +263,19 @@ namespace FlaxEditor.GUI
|
||||
PerformLayout(true);
|
||||
_searchBox.Focus();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sorts the items list (by item name by default).
|
||||
/// </summary>
|
||||
public void SortItems()
|
||||
{
|
||||
ItemsPanel.SortChildren();
|
||||
if (_categoryPanels != null)
|
||||
{
|
||||
for (int i = 0; i < _categoryPanels.Count; i++)
|
||||
_categoryPanels[i].SortChildren();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds the item to the view and registers for the click event.
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace FlaxEditor.GUI
|
||||
{
|
||||
Find(Level.GetScene(i));
|
||||
}
|
||||
SortChildren();
|
||||
SortItems();
|
||||
}
|
||||
|
||||
private void OnItemClicked(Item item)
|
||||
|
||||
@@ -122,7 +122,7 @@ namespace FlaxEditor.GUI
|
||||
if (project.Content != null)
|
||||
FindAssets(project.Content.Folder);
|
||||
}
|
||||
SortChildren();
|
||||
SortItems();
|
||||
}
|
||||
|
||||
private void OnItemClicked(Item item)
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace FlaxEditor.GUI
|
||||
{
|
||||
Find(Level.GetScene(i));
|
||||
}
|
||||
SortChildren();
|
||||
SortItems();
|
||||
}
|
||||
|
||||
private void OnItemClicked(Item item)
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace FlaxEditor.GUI
|
||||
}
|
||||
}
|
||||
}
|
||||
SortChildren();
|
||||
SortItems();
|
||||
}
|
||||
|
||||
private void OnItemClicked(Item item)
|
||||
|
||||
@@ -126,7 +126,7 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
});
|
||||
}
|
||||
cm.ItemClicked += item => AddModule((ushort)item.Tag);
|
||||
cm.SortChildren();
|
||||
cm.SortItems();
|
||||
cm.Show(this, button.BottomLeft);
|
||||
}
|
||||
|
||||
|
||||
@@ -461,7 +461,7 @@ namespace FlaxEditor.Surface
|
||||
cm.AddItem(item);
|
||||
}
|
||||
cm.ItemClicked += OnAddParameterItemClicked;
|
||||
cm.SortChildren();
|
||||
cm.SortItems();
|
||||
cm.Show(button.Parent, button.BottomLeft);
|
||||
}
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ namespace FlaxEditor.Windows.Assets
|
||||
cm.AddItem(item);
|
||||
}
|
||||
cm.ItemClicked += (ItemsListContextMenu.Item item) => window.SetParamType(index, (ScriptType)item.Tag);
|
||||
cm.SortChildren();
|
||||
cm.SortItems();
|
||||
cm.Show(window, window.PointFromScreen(Input.MouseScreenPosition));
|
||||
});
|
||||
b.Enabled = window._canEdit;
|
||||
|
||||
Reference in New Issue
Block a user