2021-12-05 23:31:45 +08:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Framework.Input.Events;
|
|
|
|
|
|
|
|
namespace osu.Game.Beatmaps.Drawables.Cards
|
|
|
|
{
|
|
|
|
public partial class HoverHandlingContainer : Container
|
|
|
|
{
|
|
|
|
public Func<HoverEvent, bool>? Hovered { get; set; }
|
|
|
|
public Action<HoverLostEvent>? Unhovered { get; set; }
|
|
|
|
|
2021-12-07 03:52:06 +08:00
|
|
|
protected override bool OnHover(HoverEvent e)
|
|
|
|
{
|
|
|
|
bool handledByBase = base.OnHover(e);
|
|
|
|
return Hovered?.Invoke(e) ?? handledByBase;
|
|
|
|
}
|
2021-12-05 23:31:45 +08:00
|
|
|
|
|
|
|
protected override void OnHoverLost(HoverLostEvent e)
|
|
|
|
{
|
2021-12-07 03:52:06 +08:00
|
|
|
base.OnHoverLost(e);
|
|
|
|
Unhovered?.Invoke(e);
|
2021-12-05 23:31:45 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|