From fde243ed8b5456835f088c9c6d10e0e9db40bcac Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Fri, 18 Sep 2020 18:11:46 +0200 Subject: [PATCH] only display the tooltip if there is anything in it --- MLEM.Ui/Elements/Tooltip.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/MLEM.Ui/Elements/Tooltip.cs b/MLEM.Ui/Elements/Tooltip.cs index 618b1f0..d661bd1 100644 --- a/MLEM.Ui/Elements/Tooltip.cs +++ b/MLEM.Ui/Elements/Tooltip.cs @@ -1,4 +1,5 @@ using System; +using System.Linq; using Microsoft.Xna.Framework; using MLEM.Ui.Style; @@ -38,6 +39,9 @@ namespace MLEM.Ui.Elements { if (elementToHover != null) { elementToHover.OnMouseEnter += element => { + // only display the tooltip if there is anything in it + if (!this.Children.Any()) + return; element.System.Add(element.GetType().Name + "Tooltip", this); this.SnapPositionToMouse(); };