mirror of
https://github.com/osukey/osukey.git
synced 2025-08-08 09:03:50 +09:00
Pass down input state instead of parent lookup
This commit is contained in:
@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
/// Invoked when this <see cref="HitObjectMask"/> has requested selection.
|
/// Invoked when this <see cref="HitObjectMask"/> has requested selection.
|
||||||
/// Will fire even if already selected. Does not actually perform selection.
|
/// Will fire even if already selected. Does not actually perform selection.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action<HitObjectMask> SelectionRequested;
|
public event Action<HitObjectMask, InputState> SelectionRequested;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The <see cref="DrawableHitObject"/> which this <see cref="HitObjectMask"/> applies to.
|
/// 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)
|
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
||||||
{
|
{
|
||||||
SelectionRequested?.Invoke(this);
|
SelectionRequested?.Invoke(this, state);
|
||||||
return base.OnMouseDown(state, args);
|
return base.OnMouseDown(state, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Input;
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using RectangleF = osu.Framework.Graphics.Primitives.RectangleF;
|
using RectangleF = osu.Framework.Graphics.Primitives.RectangleF;
|
||||||
|
|
||||||
@ -26,7 +27,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invoked when any <see cref="HitObjectMask"/> requests selection.
|
/// Invoked when any <see cref="HitObjectMask"/> requests selection.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action<HitObjectMask> MaskSelectionRequested;
|
public event Action<HitObjectMask, InputState> MaskSelectionRequested;
|
||||||
|
|
||||||
private IEnumerable<HitObjectMask> aliveMasks => AliveInternalChildren.Cast<HitObjectMask>();
|
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 onMaskSelected(HitObjectMask mask) => MaskSelected?.Invoke(mask);
|
||||||
private void onMaskDeselected(HitObjectMask mask) => MaskDeselected?.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)
|
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.
|
/// Handle a mask requesting selection.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="mask">The mask.</param>
|
/// <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)
|
if (mask.State == Visibility.Visible)
|
||||||
// we don't want this deselection to affect input for this frame.
|
// we don't want this deselection to affect input for this frame.
|
||||||
|
Reference in New Issue
Block a user