fix(ui): add Crown icon and hover tooltip to Honorific title slot
This commit is contained in:
@@ -383,4 +383,7 @@ internal class HellionStrings
|
|||||||
internal static string Settings_Integrations_GotAnIdea_SectionHeader => Get(nameof(Settings_Integrations_GotAnIdea_SectionHeader));
|
internal static string Settings_Integrations_GotAnIdea_SectionHeader => Get(nameof(Settings_Integrations_GotAnIdea_SectionHeader));
|
||||||
internal static string Settings_Integrations_GotAnIdea_Body => Get(nameof(Settings_Integrations_GotAnIdea_Body));
|
internal static string Settings_Integrations_GotAnIdea_Body => Get(nameof(Settings_Integrations_GotAnIdea_Body));
|
||||||
internal static string Settings_Integrations_GotAnIdea_LinkLabel => Get(nameof(Settings_Integrations_GotAnIdea_LinkLabel));
|
internal static string Settings_Integrations_GotAnIdea_LinkLabel => Get(nameof(Settings_Integrations_GotAnIdea_LinkLabel));
|
||||||
|
|
||||||
|
// Hellion Chat — v1.3.0 Honorific title slot tooltip
|
||||||
|
internal static string ChatHeader_HonorificTitle_Tooltip => Get(nameof(ChatHeader_HonorificTitle_Tooltip));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -866,4 +866,7 @@
|
|||||||
<data name="Settings_Integrations_GotAnIdea_LinkLabel" xml:space="preserve">
|
<data name="Settings_Integrations_GotAnIdea_LinkLabel" xml:space="preserve">
|
||||||
<value>discord.gg/X9V7Kcv5gR</value>
|
<value>discord.gg/X9V7Kcv5gR</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="ChatHeader_HonorificTitle_Tooltip" xml:space="preserve">
|
||||||
|
<value>Custom-Titel von Honorific</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
|
|||||||
@@ -866,4 +866,7 @@
|
|||||||
<data name="Settings_Integrations_GotAnIdea_LinkLabel" xml:space="preserve">
|
<data name="Settings_Integrations_GotAnIdea_LinkLabel" xml:space="preserve">
|
||||||
<value>discord.gg/X9V7Kcv5gR</value>
|
<value>discord.gg/X9V7Kcv5gR</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="ChatHeader_HonorificTitle_Tooltip" xml:space="preserve">
|
||||||
|
<value>Honorific custom title</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
|
|||||||
@@ -1727,13 +1727,22 @@ public sealed class ChatLogWindow : Window
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Truncate with ellipsis when the title would overlap the pop-out
|
// Reserve space for the crown icon plus a small gap before the title,
|
||||||
// button. We reserve the icon width plus a small gap so the title
|
// then the title itself, then the gap-to-pop-out-button. We measure the
|
||||||
// never touches the button edge — readability over information density.
|
// crown width inside the FontAwesome font push because FontAwesome
|
||||||
const float gapPx = 8f;
|
// glyphs render in a different font than the regular ImGui text.
|
||||||
|
const float gapAfterCrown = 4f;
|
||||||
|
const float gapBeforeButton = 8f;
|
||||||
var avail = ImGui.GetContentRegionAvail().X;
|
var avail = ImGui.GetContentRegionAvail().X;
|
||||||
var iconWidth = ImGui.GetFrameHeight();
|
var iconWidth = ImGui.GetFrameHeight();
|
||||||
var maxTitleWidth = avail - iconWidth - gapPx;
|
|
||||||
|
float crownWidth;
|
||||||
|
using (Plugin.FontManager.FontAwesome.Push())
|
||||||
|
{
|
||||||
|
crownWidth = ImGui.CalcTextSize(FontAwesomeIcon.Crown.ToIconString()).X;
|
||||||
|
}
|
||||||
|
|
||||||
|
var maxTitleWidth = avail - iconWidth - gapBeforeButton - crownWidth - gapAfterCrown;
|
||||||
if (maxTitleWidth <= 0)
|
if (maxTitleWidth <= 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@@ -1742,14 +1751,32 @@ public sealed class ChatLogWindow : Window
|
|||||||
var rendered = "«" + title!.Title + "»";
|
var rendered = "«" + title!.Title + "»";
|
||||||
rendered = TruncateToWidth(rendered, maxTitleWidth);
|
rendered = TruncateToWidth(rendered, maxTitleWidth);
|
||||||
|
|
||||||
var color = title.Color is { } c
|
var titleColor = title.Color is { } c
|
||||||
? new Vector4(c.X, c.Y, c.Z, 1f)
|
? new Vector4(c.X, c.Y, c.Z, 1f)
|
||||||
: ImGui.GetStyle().Colors[(int)ImGuiCol.Text];
|
: ImGui.GetStyle().Colors[(int)ImGuiCol.Text];
|
||||||
|
|
||||||
using (ImRaii.PushColor(ImGuiCol.Text, color))
|
var theme = Plugin.ThemeRegistry.Active;
|
||||||
|
|
||||||
|
// Group so the tooltip's IsItemHovered check fires for hover anywhere
|
||||||
|
// on the crown-plus-title pair, not just one of the two.
|
||||||
|
ImGui.BeginGroup();
|
||||||
|
using (ImRaii.PushColor(ImGuiCol.Text, ColourUtil.RgbaToAbgr(theme.Colors.TextMuted)))
|
||||||
|
using (Plugin.FontManager.FontAwesome.Push())
|
||||||
|
{
|
||||||
|
ImGui.TextUnformatted(FontAwesomeIcon.Crown.ToIconString());
|
||||||
|
}
|
||||||
|
ImGui.SameLine(0f, gapAfterCrown);
|
||||||
|
using (ImRaii.PushColor(ImGuiCol.Text, titleColor))
|
||||||
{
|
{
|
||||||
ImGui.TextUnformatted(rendered);
|
ImGui.TextUnformatted(rendered);
|
||||||
}
|
}
|
||||||
|
ImGui.EndGroup();
|
||||||
|
|
||||||
|
if (ImGui.IsItemHovered())
|
||||||
|
{
|
||||||
|
ImGui.SetTooltip(HellionStrings.ChatHeader_HonorificTitle_Tooltip);
|
||||||
|
}
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user