mirror of https://github.com/ppy/osu
Ensure hover handling container always calls base on hover events
This commit is contained in:
parent
ccfc361626
commit
82ed8eae6b
|
@ -14,14 +14,16 @@ public class HoverHandlingContainer : Container
|
||||||
public Func<HoverEvent, bool>? Hovered { get; set; }
|
public Func<HoverEvent, bool>? Hovered { get; set; }
|
||||||
public Action<HoverLostEvent>? Unhovered { get; set; }
|
public Action<HoverLostEvent>? Unhovered { get; set; }
|
||||||
|
|
||||||
protected override bool OnHover(HoverEvent e) => Hovered?.Invoke(e) ?? base.OnHover(e);
|
protected override bool OnHover(HoverEvent e)
|
||||||
|
{
|
||||||
|
bool handledByBase = base.OnHover(e);
|
||||||
|
return Hovered?.Invoke(e) ?? handledByBase;
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnHoverLost(HoverLostEvent e)
|
protected override void OnHoverLost(HoverLostEvent e)
|
||||||
{
|
{
|
||||||
if (Unhovered != null)
|
base.OnHoverLost(e);
|
||||||
Unhovered?.Invoke(e);
|
Unhovered?.Invoke(e);
|
||||||
else
|
|
||||||
base.OnHoverLost(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue