mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 08:43:01 +08:00
Pass down input state instead of parent lookup
This commit is contained in:
parent
2b15555ede
commit
94c3f38541
@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Edit
|
||||
/// Invoked when this <see cref="HitObjectMask"/> has requested selection.
|
||||
/// Will fire even if already selected. Does not actually perform selection.
|
||||
/// </summary>
|
||||
public event Action<HitObjectMask> SelectionRequested;
|
||||
public event Action<HitObjectMask, InputState> SelectionRequested;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="DrawableHitObject"/> which this <see cref="HitObjectMask"/> applies to.
|
||||
@ -64,7 +64,7 @@ namespace osu.Game.Rulesets.Edit
|
||||
|
||||
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
||||
{
|
||||
SelectionRequested?.Invoke(this);
|
||||
SelectionRequested?.Invoke(this, state);
|
||||
return base.OnMouseDown(state, args);
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Input;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using RectangleF = osu.Framework.Graphics.Primitives.RectangleF;
|
||||
|
||||
@ -26,7 +27,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
||||
/// <summary>
|
||||
/// Invoked when any <see cref="HitObjectMask"/> requests selection.
|
||||
/// </summary>
|
||||
public event Action<HitObjectMask> MaskSelectionRequested;
|
||||
public event Action<HitObjectMask, InputState> MaskSelectionRequested;
|
||||
|
||||
private IEnumerable<HitObjectMask> aliveMasks => AliveInternalChildren.Cast<HitObjectMask>();
|
||||
|
||||
@ -78,7 +79,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
||||
|
||||
private void onMaskSelected(HitObjectMask mask) => MaskSelected?.Invoke(mask);
|
||||
private void onMaskDeselected(HitObjectMask mask) => MaskDeselected?.Invoke(mask);
|
||||
private void onSelectionRequested(HitObjectMask mask) => MaskSelectionRequested?.Invoke(mask);
|
||||
private void onSelectionRequested(HitObjectMask mask, InputState state) => MaskSelectionRequested?.Invoke(mask, state);
|
||||
|
||||
protected override int Compare(Drawable x, Drawable y)
|
||||
{
|
||||
|
@ -119,9 +119,9 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
||||
/// Handle a mask requesting selection.
|
||||
/// </summary>
|
||||
/// <param name="mask">The mask.</param>
|
||||
public void HandleSelectionRequested(HitObjectMask mask)
|
||||
public void HandleSelectionRequested(HitObjectMask mask, InputState state)
|
||||
{
|
||||
if (GetContainingInputManager().CurrentState.Keyboard.ControlPressed)
|
||||
if (state.Keyboard.ControlPressed)
|
||||
{
|
||||
if (mask.State == Visibility.Visible)
|
||||
// we don't want this deselection to affect input for this frame.
|
||||
|
Loading…
Reference in New Issue
Block a user