Fixed Nameplate.

This commit is contained in:
defnotken
2025-10-06 22:48:50 -05:00
parent a7378652c4
commit 1d88c04235

View File

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