1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-26 14:38:34 +01:00

only display the tooltip if there is anything in it

This commit is contained in:
Ell 2020-09-18 18:11:46 +02:00
parent 2342eb093a
commit fde243ed8b

View file

@ -1,4 +1,5 @@
using System; using System;
using System.Linq;
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using MLEM.Ui.Style; using MLEM.Ui.Style;
@ -38,6 +39,9 @@ namespace MLEM.Ui.Elements {
if (elementToHover != null) { if (elementToHover != null) {
elementToHover.OnMouseEnter += element => { 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); element.System.Add(element.GetType().Name + "Tooltip", this);
this.SnapPositionToMouse(); this.SnapPositionToMouse();
}; };