From 70c296a16b0ae87491cafc0ed2d7866b40346153 Mon Sep 17 00:00:00 2001 From: defnotken Date: Fri, 10 Oct 2025 16:26:36 -0500 Subject: [PATCH 1/2] Nameplate Fix + Text Handling --- LightlessSync/Services/NameplateHandler.cs | 50 +++++++++++----------- LightlessSync/UI/SettingsUi.cs | 4 +- 2 files changed, 29 insertions(+), 25 deletions(-) diff --git a/LightlessSync/Services/NameplateHandler.cs b/LightlessSync/Services/NameplateHandler.cs index 74edabc..7f0f315 100644 --- a/LightlessSync/Services/NameplateHandler.cs +++ b/LightlessSync/Services/NameplateHandler.cs @@ -360,33 +360,35 @@ public unsafe class NameplateHandler : IMediatorSubscriber } int positionX; + + if (!config.LightfinderLabelUseIcon && (string.IsNullOrWhiteSpace(labelContent) || string.Equals(labelContent, "-", StringComparison.Ordinal))) + labelContent = DefaultLabelText; + + pNode->FontType = config.LightfinderLabelUseIcon ? FontType.Axis : FontType.MiedingerMed; + + pNode->SetText(labelContent); + + if (!config.LightfinderLabelUseIcon) + { + pNode->TextFlags &= ~TextFlags.AutoAdjustNodeSize; + pNode->AtkResNode.Width = 0; + nodeWidth = (int)pNode->AtkResNode.GetWidth(); + if (nodeWidth <= 0) + nodeWidth = (int)System.Math.Round(AtkNodeHelpers.DefaultTextNodeWidth * effectiveScale); + pNode->AtkResNode.Width = (ushort)nodeWidth; + } + else + { + pNode->TextFlags |= TextFlags.AutoAdjustNodeSize; + pNode->AtkResNode.Width = 0; + nodeWidth = pNode->AtkResNode.GetWidth(); + } + + if (config.LightfinderAutoAlign && nameContainer != null && hasValidOffset) { var nameplateWidth = (int)nameContainer->Width; - if (!config.LightfinderLabelUseIcon) - { - pNode->TextFlags &= ~TextFlags.AutoAdjustNodeSize; - pNode->AtkResNode.Width = 0; - pNode->SetText(labelContent); - - nodeWidth = (int)pNode->AtkResNode.GetWidth(); - if (nodeWidth <= 0) - nodeWidth = (int)System.Math.Round(AtkNodeHelpers.DefaultTextNodeWidth * effectiveScale); - - if (nodeWidth > nameplateWidth) - nodeWidth = nameplateWidth; - - pNode->AtkResNode.Width = (ushort)nodeWidth; - } - else - { - pNode->TextFlags |= TextFlags.AutoAdjustNodeSize; - pNode->AtkResNode.Width = 0; - pNode->SetText(labelContent); - nodeWidth = (int)pNode->AtkResNode.GetWidth(); - } - int leftPos = nameplateWidth / 8; int rightPos = nameplateWidth - nodeWidth - (nameplateWidth / 8); int centrePos = (nameplateWidth - nodeWidth) / 2; @@ -414,7 +416,7 @@ public unsafe class NameplateHandler : IMediatorSubscriber positionX = 58 + config.LightfinderLabelOffsetX; alignment = AlignmentType.Bottom; } - + positionY += config.LightfinderLabelOffsetY; alignment = (AlignmentType)System.Math.Clamp((int)alignment, 0, 8); diff --git a/LightlessSync/UI/SettingsUi.cs b/LightlessSync/UI/SettingsUi.cs index 84e4e94..8a92b65 100644 --- a/LightlessSync/UI/SettingsUi.cs +++ b/LightlessSync/UI/SettingsUi.cs @@ -1254,7 +1254,8 @@ public class SettingsUi : WindowMediatorSubscriberBase var selected = i == _lightfinderIconPresetIndex; if (ImGui.Selectable(preview, selected)) { - ApplyLightfinderIcon(optionGlyph, i); + _lightfinderIconInput = NameplateHandler.ToIconEditorString(optionGlyph); + _lightfinderIconPresetIndex = i; } } @@ -2594,6 +2595,7 @@ public class SettingsUi : WindowMediatorSubscriberBase _lightfinderIconInput = NameplateHandler.ToIconEditorString(normalizedGlyph); _lightfinderIconPresetIndex = presetIndex; _lightfinderIconInputInitialized = true; + ImGui.SetKeyboardFocusHere(-1); } private void DrawSettingsContent() -- 2.49.1 From 387e5ad51542c15c2684ebefe5bc3a16940f86b1 Mon Sep 17 00:00:00 2001 From: defnotken Date: Fri, 10 Oct 2025 16:27:40 -0500 Subject: [PATCH 2/2] oop --- LightlessSync/UI/SettingsUi.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/LightlessSync/UI/SettingsUi.cs b/LightlessSync/UI/SettingsUi.cs index 8a92b65..2589601 100644 --- a/LightlessSync/UI/SettingsUi.cs +++ b/LightlessSync/UI/SettingsUi.cs @@ -2595,7 +2595,6 @@ public class SettingsUi : WindowMediatorSubscriberBase _lightfinderIconInput = NameplateHandler.ToIconEditorString(normalizedGlyph); _lightfinderIconPresetIndex = presetIndex; _lightfinderIconInputInitialized = true; - ImGui.SetKeyboardFocusHere(-1); } private void DrawSettingsContent() -- 2.49.1