Add the option to deselect all whereve there is a select all, Refactor much of the codebase to use keybinds from InputOptions.

This commit is contained in:
Menotdan
2023-12-08 20:16:07 -05:00
parent bcce52ca22
commit 13cc45c3d7
13 changed files with 179 additions and 65 deletions

View File

@@ -190,6 +190,7 @@ namespace FlaxEditor.Content.GUI
OnDelete?.Invoke(_selection);
}),
new InputActionsContainer.Binding(options => options.SelectAll, SelectAll),
new InputActionsContainer.Binding(options => options.DeselectAll, DeselectAll),
new InputActionsContainer.Binding(options => options.Rename, () =>
{
if (HasSelection && _selection[0].CanRename)
@@ -394,10 +395,7 @@ namespace FlaxEditor.Content.GUI
PerformLayout();
}
/// <summary>
/// Selects all the items.
/// </summary>
public void SelectAll()
private void BulkSelectUpdate(bool select = true)
{
// Lock layout
var wasLayoutLocked = IsLayoutLocked;
@@ -405,13 +403,30 @@ namespace FlaxEditor.Content.GUI
// Select items
_selection.Clear();
_selection.AddRange(_items);
if (select)
_selection.AddRange(_items);
// Unload and perform UI layout
IsLayoutLocked = wasLayoutLocked;
PerformLayout();
}
/// <summary>
/// Selects all the items.
/// </summary>
public void SelectAll()
{
BulkSelectUpdate(true);
}
/// <summary>
/// Deselects all the items.
/// </summary>
public void DeselectAll()
{
BulkSelectUpdate(false);
}
/// <summary>
/// Deselects the specified item.
/// </summary>