Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
fix: fixed tooltip for rotations.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Apr 21, 2023
1 parent e1ad817 commit 4dc331c
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions RotationSolver/UI/ImGuiHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ public static void DrawTooltip(Action act, string id)
}
}
public static void DrawEnableTexture<T>(this T texture, bool isSelected, Action selected,
Action<string> showToolTip = null, Action<Action<string>> additionalHeader = null,
Action<T> showToolTip = null, Action<Action<T>> additionalHeader = null,
Action otherThing = null) where T : class, ITexture
{
showToolTip ??= text =>
{
if (!string.IsNullOrEmpty(text)) ImGui.SetTooltip(text);
if (!string.IsNullOrEmpty(text.Description)) ImGui.SetTooltip(text.Description);
};

ImGui.PushStyleVar(ImGuiStyleVar.FramePadding, new Vector2(3f, 3f));
Expand All @@ -53,7 +53,7 @@ public static void DrawEnableTexture<T>(this T texture, bool isSelected, Action
var desc = texture?.Description;
if (ImGui.IsItemHovered())
{
showToolTip(desc);
showToolTip(texture);
if (ImGui.IsMouseClicked(ImGuiMouseButton.Left))
{
selected?.Invoke();
Expand All @@ -72,7 +72,7 @@ public static void DrawEnableTexture<T>(this T texture, bool isSelected, Action

if (ImGui.IsItemHovered())
{
showToolTip(desc);
showToolTip(texture);
}

if(texture is IAction)
Expand Down Expand Up @@ -386,15 +386,15 @@ public unsafe static void Display(this ICustomRotation rotation, ICustomRotation
var t = IconSet.GetTexture(IconSet.GetJobIcon(rotation, IconType.Framed));
ImGui.Image(t.ImGuiHandle, new Vector2(t.Width, t.Height));
if (!string.IsNullOrEmpty(text))
if (!string.IsNullOrEmpty(text.Description))
{
ImGui.SameLine();
ImGui.Text(" ");
ImGui.SameLine();
ImGui.Text(text);
ImGui.Text(text.Description);
}
var type = rotation.GetType();
var type = text.GetType();
var attrs = new List<RotationDescAttribute> { RotationDescAttribute.MergeToOne(type.GetCustomAttributes<RotationDescAttribute>()) };
Expand All @@ -407,7 +407,7 @@ public unsafe static void Display(this ICustomRotation rotation, ICustomRotation
{
foreach (var a in RotationDescAttribute.Merge(attrs))
{
RotationDescAttribute.MergeToOne(a)?.Display(rotation);
RotationDescAttribute.MergeToOne(a)?.Display(text);
}
}
catch (Exception ex)
Expand All @@ -420,7 +420,7 @@ public unsafe static void Display(this ICustomRotation rotation, ICustomRotation
}
ImGui.Text(ex.StackTrace);
}
}, "Popup" + rotation.GetHashCode().ToString());
}, "Popup" + text.GetHashCode().ToString());
},
showToolTip =>
{
Expand All @@ -442,7 +442,7 @@ public unsafe static void Display(this ICustomRotation rotation, ICustomRotation
}
if (ImGui.IsItemHovered())
{
showToolTip?.Invoke(r.Description);
showToolTip?.Invoke(r);
}
ImGui.PopStyleColor();
}
Expand Down

0 comments on commit 4dc331c

Please sign in to comment.