diff --git a/LightlessSync/Services/NameplateHandler.cs b/LightlessSync/Services/NameplateHandler.cs index e0c788e..0c4d65b 100644 --- a/LightlessSync/Services/NameplateHandler.cs +++ b/LightlessSync/Services/NameplateHandler.cs @@ -272,7 +272,6 @@ public unsafe class NameplateHandler : IMediatorSubscriber pNode->FontType = config.LightfinderLabelUseIcon ? FontType.Axis : FontType.MiedingerMed; pNode->AtkResNode.SetScale(effectiveScale, effectiveScale); - pNode->SetText(labelContent); var nodeWidth = (int)pNode->AtkResNode.GetWidth(); if (nodeWidth <= 0) nodeWidth = (int)System.Math.Round(AtkNodeHelpers.DefaultTextNodeWidth * effectiveScale); @@ -365,22 +364,39 @@ public unsafe class NameplateHandler : IMediatorSubscriber { var nameplateWidth = (int)nameContainer->Width; - if (!config.LightfinderLabelUseIcon && nodeWidth > nameplateWidth) - nodeWidth = nameplateWidth; - 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; int staticMargin = 24; - int calcMargin = (int)(nameplateWidth * 0.15f); - + int calcMargin = (int)(nameplateWidth * 0.08f); + switch (config.LabelAlignment) { case LabelAlignment.Left: - positionX = config.LightfinderLabelUseIcon ? leftPos + staticMargin : calcMargin; + positionX = config.LightfinderLabelUseIcon ? leftPos + staticMargin : leftPos; alignment = AlignmentType.BottomLeft; break; case LabelAlignment.Right: