From 94c3f385418263bc5c99af6b3cb99431c4ccfda4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 4 Apr 2018 20:06:45 +0900 Subject: [PATCH] Pass down input state instead of parent lookup --- osu.Game/Rulesets/Edit/HitObjectMask.cs | 4 ++-- .../Screens/Edit/Screens/Compose/Layers/MaskContainer.cs | 5 +++-- .../Screens/Edit/Screens/Compose/Layers/MaskSelection.cs | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/osu.Game/Rulesets/Edit/HitObjectMask.cs b/osu.Game/Rulesets/Edit/HitObjectMask.cs index 910da712b4..741f600a21 100644 --- a/osu.Game/Rulesets/Edit/HitObjectMask.cs +++ b/osu.Game/Rulesets/Edit/HitObjectMask.cs @@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Edit /// Invoked when this has requested selection. /// Will fire even if already selected. Does not actually perform selection. /// - public event Action SelectionRequested; + public event Action SelectionRequested; /// /// The which this 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); } diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs index 401cd16fef..cade7daae2 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs @@ -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 /// /// Invoked when any requests selection. /// - public event Action MaskSelectionRequested; + public event Action MaskSelectionRequested; private IEnumerable aliveMasks => AliveInternalChildren.Cast(); @@ -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) { diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs index c874d84997..249659c2a4 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs @@ -119,9 +119,9 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers /// Handle a mask requesting selection. /// /// The mask. - 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.