Group selection actions back up in SelectionHandler

This commit is contained in:
Bartłomiej Dach
2020-10-28 22:03:59 +01:00
parent 3c2e2f29bc
commit 202fe09306
4 changed files with 6 additions and 27 deletions

View File

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

View File

@ -8,13 +8,10 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Screens.Edit;
using osuTK; using osuTK;
using osuTK.Input;
namespace osu.Game.Rulesets.Edit namespace osu.Game.Rulesets.Edit
{ {
@ -55,20 +52,6 @@ namespace osu.Game.Rulesets.Edit
updateState(); 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; private SelectionState state;
public event Action<SelectionState> StateChanged; public event Action<SelectionState> StateChanged;

View File

@ -298,13 +298,6 @@ namespace osu.Game.Screens.Edit.Compose.Components
{ {
Debug.Assert(!clickSelectionBegan); Debug.Assert(!clickSelectionBegan);
// Deselections are only allowed for control + left clicks
bool allowDeselection = e.ControlPressed && e.Button == MouseButton.Left;
// Todo: This is probably incorrectly disallowing multiple selections on stacked objects
if (!allowDeselection && SelectionHandler.SelectedBlueprints.Any(s => s.IsHovered))
return;
foreach (SelectionBlueprint blueprint in SelectionBlueprints.AliveChildren) foreach (SelectionBlueprint blueprint in SelectionBlueprints.AliveChildren)
{ {
if (blueprint.IsHovered) if (blueprint.IsHovered)

View File

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