1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-23 16:27:20 +08:00

added function so circle is deleted when shift+right click

This commit is contained in:
Charlie 2020-10-26 13:40:42 -05:00
parent 89797d7a57
commit ead3c19567

View File

@ -14,6 +14,7 @@ using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Framework.Input.States;
using osu.Game.Audio;
using osu.Game.Graphics;
@ -32,6 +33,8 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// </summary>
public class SelectionHandler : CompositeDrawable, IKeyBindingHandler<PlatformAction>, IHasContextMenu
{
private bool shiftPressed;
public IEnumerable<SelectionBlueprint> SelectedBlueprints => selectedBlueprints;
private readonly List<SelectionBlueprint> selectedBlueprints;
@ -164,6 +167,17 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// <returns>Whether any <see cref="DrawableHitObject"/>s could be reversed.</returns>
public virtual bool HandleReverse() => false;
protected override bool OnKeyDown(KeyDownEvent e)
{
shiftPressed = e.ShiftPressed;
return false;
}
protected override void OnKeyUp(KeyUpEvent e)
{
shiftPressed = e.ShiftPressed;
}
public bool OnPressed(PlatformAction action)
{
switch (action.ActionMethod)
@ -455,6 +469,12 @@ namespace osu.Game.Screens.Edit.Compose.Components
{
get
{
if (shiftPressed)
{
deleteSelected();
return null;
}
if (!selectedBlueprints.Any(b => b.IsHovered))
return Array.Empty<MenuItem>();