Ensure hover handling container always calls base on hover events

This commit is contained in:
Bartłomiej Dach 2021-12-06 20:52:06 +01:00
parent ccfc361626
commit 82ed8eae6b
No known key found for this signature in database
GPG Key ID: BCECCD4FA41F6497
1 changed files with 7 additions and 5 deletions

View File

@ -14,14 +14,16 @@ public class HoverHandlingContainer : Container
public Func<HoverEvent, bool>? Hovered { 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)
{
if (Unhovered != null)
Unhovered?.Invoke(e);
else
base.OnHoverLost(e);
base.OnHoverLost(e);
Unhovered?.Invoke(e);
}
}
}