mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 23:13:20 +08:00
Add Ctrl+A to select all (esc to deselect all)
This commit is contained in:
parent
cceb982f57
commit
f3dc38e342
@ -10,6 +10,7 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
@ -17,10 +18,11 @@ using osu.Game.Rulesets.Edit.Tools;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osuTK;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Screens.Edit.Compose.Components
|
||||
{
|
||||
public class BlueprintContainer : CompositeDrawable
|
||||
public class BlueprintContainer : CompositeDrawable, IKeyBindingHandler<PlatformAction>
|
||||
{
|
||||
public event Action<IEnumerable<HitObject>> SelectionChanged;
|
||||
|
||||
@ -169,6 +171,37 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override bool OnKeyDown(KeyDownEvent e)
|
||||
{
|
||||
switch (e.Key)
|
||||
{
|
||||
case Key.Escape:
|
||||
if (!selectionHandler.SelectedBlueprints.Any())
|
||||
return false;
|
||||
|
||||
deselectAll();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected override bool OnKeyUp(KeyUpEvent e) => false;
|
||||
|
||||
public bool OnPressed(PlatformAction action)
|
||||
{
|
||||
switch (action.ActionType)
|
||||
{
|
||||
case PlatformActionType.SelectAll:
|
||||
selectAll();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool OnReleased(PlatformAction action) => false;
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
@ -314,6 +347,15 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Selects all <see cref="SelectionBlueprint"/>s.
|
||||
/// </summary>
|
||||
private void selectAll()
|
||||
{
|
||||
selectionBlueprints.ToList().ForEach(m => m.Select());
|
||||
selectionHandler.UpdateVisibility();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deselects all selected <see cref="SelectionBlueprint"/>s.
|
||||
/// </summary>
|
||||
|
Loading…
Reference in New Issue
Block a user