mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 23:53:51 +09:00
moved right click shift delete functionality to HandleSelectionRequested + reduced func size
This commit is contained in:
@ -25,6 +25,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
|
||||||
{
|
{
|
||||||
@ -33,7 +34,6 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class SelectionHandler : CompositeDrawable, IKeyBindingHandler<PlatformAction>, IHasContextMenu
|
public class SelectionHandler : CompositeDrawable, IKeyBindingHandler<PlatformAction>, IHasContextMenu
|
||||||
{
|
{
|
||||||
private bool shiftPressed;
|
|
||||||
|
|
||||||
public IEnumerable<SelectionBlueprint> SelectedBlueprints => selectedBlueprints;
|
public IEnumerable<SelectionBlueprint> SelectedBlueprints => selectedBlueprints;
|
||||||
private readonly List<SelectionBlueprint> selectedBlueprints;
|
private readonly List<SelectionBlueprint> selectedBlueprints;
|
||||||
@ -167,17 +167,6 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
/// <returns>Whether any <see cref="DrawableHitObject"/>s could be reversed.</returns>
|
/// <returns>Whether any <see cref="DrawableHitObject"/>s could be reversed.</returns>
|
||||||
public virtual bool HandleReverse() => false;
|
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)
|
public bool OnPressed(PlatformAction action)
|
||||||
{
|
{
|
||||||
switch (action.ActionMethod)
|
switch (action.ActionMethod)
|
||||||
@ -237,6 +226,13 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
/// <param name="blueprint">The blueprint.</param>
|
/// <param name="blueprint">The blueprint.</param>
|
||||||
/// <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)
|
||||||
|
{
|
||||||
|
shiftClickDeleteCheck(blueprint, state);
|
||||||
|
multiSelectionHandler(blueprint, state);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void multiSelectionHandler(SelectionBlueprint blueprint, InputState state)
|
||||||
{
|
{
|
||||||
if (state.Keyboard.ControlPressed)
|
if (state.Keyboard.ControlPressed)
|
||||||
{
|
{
|
||||||
@ -255,6 +251,15 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void shiftClickDeleteCheck(SelectionBlueprint blueprint, InputState state)
|
||||||
|
{
|
||||||
|
if (state.Keyboard.ShiftPressed && state.Mouse.IsPressed(MouseButton.Right))
|
||||||
|
{
|
||||||
|
EditorBeatmap.Remove(blueprint.HitObject);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void deleteSelected()
|
private void deleteSelected()
|
||||||
{
|
{
|
||||||
EditorBeatmap.RemoveRange(selectedBlueprints.Select(b => b.HitObject));
|
EditorBeatmap.RemoveRange(selectedBlueprints.Select(b => b.HitObject));
|
||||||
@ -469,12 +474,6 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (shiftPressed)
|
|
||||||
{
|
|
||||||
deleteSelected();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!selectedBlueprints.Any(b => b.IsHovered))
|
if (!selectedBlueprints.Any(b => b.IsHovered))
|
||||||
return Array.Empty<MenuItem>();
|
return Array.Empty<MenuItem>();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user