mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 21:24:16 +01:00
feat: move UIDebug PrintOutObject into Util, add ImGuiHelpers.ClickToCopyText
This commit is contained in:
parent
fb0d0de3ad
commit
65d0acaf64
3 changed files with 169 additions and 156 deletions
|
|
@ -119,5 +119,23 @@ namespace Dalamud.Interface
|
|||
{
|
||||
GlobalScale = ImGui.GetIO().FontGlobalScale;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print out text that can be copied when clicked.
|
||||
/// </summary>
|
||||
/// <param name="text">The text to show.</param>
|
||||
/// <param name="textCopy">The text to copy when clicked.</param>
|
||||
public static void ClickToCopyText(string text, string? textCopy = null)
|
||||
{
|
||||
textCopy ??= text;
|
||||
ImGui.Text($"{text}");
|
||||
if (ImGui.IsItemHovered())
|
||||
{
|
||||
ImGui.SetMouseCursor(ImGuiMouseCursor.Hand);
|
||||
if (textCopy != text) ImGui.SetTooltip(textCopy);
|
||||
}
|
||||
|
||||
if (ImGui.IsItemClicked()) ImGui.SetClipboardText($"{textCopy}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue