Use TextUnformatted to remove %%, add tooltip auto-wrapping

This commit is contained in:
Asriel Camora
2023-11-18 02:56:56 -08:00
parent a5033463ec
commit 2f1cbfd01b
9 changed files with 159 additions and 146 deletions
+16 -2
View File
@@ -60,7 +60,7 @@ internal static class ImGuiUtils
ImGui.SameLine(0, 0);
var textFrameHeight = ImGui.GetFrameHeight();
ImGui.AlignTextToFramePadding();
ImGui.Text(name);
ImGui.TextUnformatted(name);
GroupPanelLabelStack.Push((ImGui.GetItemRectMin(), ImGui.GetItemRectMax(), textFrameHeight / 2f)); // push rect to stack
ImGui.SameLine(0, 0);
ImGui.Dummy(new Vector2(0f, textFrameHeight + itemSpacing.Y)); // shifts content by fh + is.y
@@ -574,10 +574,24 @@ internal static class ImGuiUtils
ImGui.SetMouseCursor(ImGuiMouseCursor.Hand);
if (ImGui.IsItemClicked(ImGuiMouseButton.Left))
Process.Start(new ProcessStartInfo { FileName = url, UseShellExecute = true });
ImGui.SetTooltip("Open in Browser");
Tooltip("Open in Browser");
}
}
public static void Tooltip(string text)
{
using var _tooltip = ImRaii.Tooltip();
ImGui.TextUnformatted(text);
}
public static void TooltipWrapped(string text, float width = 300)
{
using var _tooltip = ImRaii.Tooltip();
ImGui.PushTextWrapPos(width);
ImGui.TextUnformatted(text);
ImGui.PopTextWrapPos();
}
public static void AlignCentered(float width, float availWidth = default)
{
if (availWidth == default)