mirror of
https://github.com/ppy/osu.git
synced 2025-03-18 06:27:18 +08:00
Merge pull request #10596 from charlie-gray/right-click-circle-delete
Add support for deleting objects when Shift is held down
This commit is contained in:
commit
8ccc3c2ec8
@ -120,6 +120,11 @@ namespace osu.Game.Rulesets.Edit
|
||||
/// </summary>
|
||||
public void Deselect() => State = SelectionState.NotSelected;
|
||||
|
||||
/// <summary>
|
||||
/// Toggles the selection state of this <see cref="OverlaySelectionBlueprint"/>.
|
||||
/// </summary>
|
||||
public void ToggleSelection() => State = IsSelected ? SelectionState.NotSelected : SelectionState.Selected;
|
||||
|
||||
public bool IsSelected => State == SelectionState.Selected;
|
||||
|
||||
/// <summary>
|
||||
|
@ -298,13 +298,6 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (blueprint.IsHovered)
|
||||
|
@ -24,6 +24,7 @@ using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
using osuTK;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Screens.Edit.Compose.Components
|
||||
{
|
||||
@ -224,21 +225,21 @@ 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.ControlPressed)
|
||||
{
|
||||
if (blueprint.IsSelected)
|
||||
blueprint.Deselect();
|
||||
else
|
||||
blueprint.Select();
|
||||
}
|
||||
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();
|
||||
else
|
||||
{
|
||||
if (blueprint.IsSelected)
|
||||
return;
|
||||
ensureSelected(blueprint);
|
||||
}
|
||||
|
||||
DeselectAll?.Invoke();
|
||||
blueprint.Select();
|
||||
}
|
||||
private void ensureSelected(SelectionBlueprint blueprint)
|
||||
{
|
||||
if (blueprint.IsSelected)
|
||||
return;
|
||||
|
||||
DeselectAll?.Invoke();
|
||||
blueprint.Select();
|
||||
}
|
||||
|
||||
private void deleteSelected()
|
||||
|
Loading…
x
Reference in New Issue
Block a user