1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 07:32:55 +08:00

pass ModCustomisationPanel through ctor

This commit is contained in:
Caiyi Shyu 2024-08-01 18:38:01 +08:00
parent 5fb364cad6
commit 188ddbcad6
2 changed files with 13 additions and 7 deletions

View File

@ -29,10 +29,11 @@ namespace osu.Game.Overlays.Mods
public readonly BindableBool Expanded = new BindableBool();
protected new ModCustomisationPanel? Parent => (ModCustomisationPanel?)base.Parent;
private readonly ModCustomisationPanel panel;
public ModCustomisationHeader()
public ModCustomisationHeader(ModCustomisationPanel panel)
{
this.panel = panel;
Action = Expanded.Toggle;
Enabled.Value = false;
}
@ -113,7 +114,7 @@ namespace osu.Game.Overlays.Mods
if (Enabled.Value)
{
if (!touchedThisFrame)
Parent?.UpdateHoverExpansion(true);
panel.UpdateHoverExpansion(true);
}
return base.OnHover(e);

View File

@ -58,7 +58,7 @@ namespace osu.Game.Overlays.Mods
InternalChildren = new Drawable[]
{
new ModCustomisationHeader
new ModCustomisationHeader(this)
{
Depth = float.MinValue,
RelativeSizeAxes = Axes.X,
@ -66,7 +66,7 @@ namespace osu.Game.Overlays.Mods
Enabled = { BindTarget = Enabled },
Expanded = { BindTarget = Expanded },
},
content = new FocusGrabbingContainer
content = new FocusGrabbingContainer(this)
{
RelativeSizeAxes = Axes.X,
BorderColour = colourProvider.Dark3,
@ -229,12 +229,17 @@ namespace osu.Game.Overlays.Mods
public override bool RequestsFocus => Expanded.Value;
public override bool AcceptsFocus => Expanded.Value;
public new ModCustomisationPanel? Parent => (ModCustomisationPanel?)base.Parent;
private readonly ModCustomisationPanel panel;
public FocusGrabbingContainer(ModCustomisationPanel panel)
{
this.panel = panel;
}
protected override void OnHoverLost(HoverLostEvent e)
{
if (ExpandedByHovering.Value && !ReceivePositionalInputAt(e.ScreenSpaceMousePosition))
Parent?.UpdateHoverExpansion(false);
panel.UpdateHoverExpansion(false);
base.OnHoverLost(e);
}