1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 05:42:56 +08:00

replace with ReceivePositionalInputAt

This commit is contained in:
Caiyi Shyu 2024-07-27 17:59:38 +08:00
parent fc842868a9
commit 77d64e0c3d

View File

@ -12,7 +12,6 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Effects;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Configuration;
@ -232,29 +231,13 @@ namespace osu.Game.Overlays.Mods
public new ModCustomisationPanel? Parent => (ModCustomisationPanel?)base.Parent;
private InputManager inputManager = null!;
protected override void LoadComplete()
{
base.LoadComplete();
inputManager = GetContainingInputManager()!;
}
protected override void OnHoverLost(HoverLostEvent e)
{
if (ExpandedByHovering.Value && !hasHoveredchild())
if (ExpandedByHovering.Value && !ReceivePositionalInputAt(e.ScreenSpaceMousePosition))
Parent?.UpdateHoverExpansion(false);
base.OnHoverLost(e);
}
private bool hasHoveredchild()
{
return inputManager.HoveredDrawables.Any(parentIsThis);
bool parentIsThis(Drawable? d)
=> d is not null && (d == this || parentIsThis(d.Parent));
}
}
}
}