1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-20 05:15:37 +08:00

Move right-click deletion logic to be handled at a SelectionBlueprint level

This commit is contained in:
Dean Herbert 2020-10-27 12:53:54 +09:00
parent 266596d404
commit 27c1a4c4d3
3 changed files with 20 additions and 5 deletions

View File

@ -107,14 +107,14 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
{
case MouseButton.Right:
rightClickPosition = e.MouseDownPosition;
return false; // Allow right click to be handled by context menu
break;
case MouseButton.Left when e.ControlPressed && IsSelected:
placementControlPointIndex = addControlPoint(e.MousePosition);
return true; // Stop input from being handled and modifying the selection
}
return false;
return base.OnMouseDown(e);
}
private int? placementControlPointIndex;

View File

@ -8,10 +8,13 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events;
using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Screens.Edit;
using osuTK;
using osuTK.Input;
namespace osu.Game.Rulesets.Edit
{
@ -52,6 +55,20 @@ namespace osu.Game.Rulesets.Edit
updateState();
}
[Resolved]
private EditorBeatmap editorBeatmap { get; set; }
protected override bool OnMouseDown(MouseDownEvent e)
{
if (e.CurrentState.Keyboard.ShiftPressed && e.IsPressed(MouseButton.Right))
{
editorBeatmap.Remove(HitObject);
return true;
}
return base.OnMouseDown(e);
}
private SelectionState state;
public event Action<SelectionState> StateChanged;

View File

@ -225,9 +225,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// <param name="state">The input state at the point of selection.</param>
internal void HandleSelectionRequested(SelectionBlueprint blueprint, InputState state)
{
if (state.Keyboard.ShiftPressed && state.Mouse.IsPressed(MouseButton.Right))
EditorBeatmap.Remove(blueprint.HitObject);
else if (state.Keyboard.ControlPressed)
if (state.Keyboard.ControlPressed)
blueprint.ToggleSelection();
else
ensureSelected(blueprint);