1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-05-10 03:28:43 +02:00

Improved ElementHelper.AddTooltip overloads

This commit is contained in:
Ell 2022-05-03 20:10:26 +02:00
parent 15a57d8db9
commit 63d2353694
2 changed files with 14 additions and 2 deletions

View file

@ -26,6 +26,7 @@ Improvements
- Allow Tooltip to manage more than one paragraph and make it easier to add new lines
- Allow adding dropdown elements at a specified index
- Turned Tooltip paragraph styling into style properties
- Improved ElementHelper.AddTooltip overloads
Fixes
- Fixed auto-nav tooltip displaying on the selected element even when not in auto-nav mode

View file

@ -184,7 +184,7 @@ namespace MLEM.Ui.Elements {
/// <param name="textCallback">The text to display on the tooltip</param>
/// <returns>The created tooltip instance</returns>
public static Tooltip AddTooltip(this Element element, Paragraph.TextCallback textCallback) {
return new Tooltip(textCallback, element);
return element.AddTooltip(new Tooltip(textCallback));
}
/// <summary>
@ -194,7 +194,18 @@ namespace MLEM.Ui.Elements {
/// <param name="text">The text to display on the tooltip</param>
/// <returns>The created tooltip instance</returns>
public static Tooltip AddTooltip(this Element element, string text) {
return new Tooltip(text, element);
return element.AddTooltip(new Tooltip(text));
}
/// <summary>
/// Adds the given <see cref="Tooltip"/> to the given element
/// </summary>
/// <param name="element">The element to add the tooltip to</param>
/// <param name="tooltip">The tooltip to add</param>
/// <returns>The passed tooltip, for chaining</returns>
public static Tooltip AddTooltip(this Element element, Tooltip tooltip) {
tooltip.AddToElement(element);
return tooltip;
}
}