Nameplate Fix + Text Handling
This commit is contained in:
@@ -360,33 +360,35 @@ public unsafe class NameplateHandler : IMediatorSubscriber
|
|||||||
}
|
}
|
||||||
int positionX;
|
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)
|
if (config.LightfinderAutoAlign && nameContainer != null && hasValidOffset)
|
||||||
{
|
{
|
||||||
var nameplateWidth = (int)nameContainer->Width;
|
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 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;
|
||||||
@@ -414,7 +416,7 @@ public unsafe class NameplateHandler : IMediatorSubscriber
|
|||||||
positionX = 58 + config.LightfinderLabelOffsetX;
|
positionX = 58 + config.LightfinderLabelOffsetX;
|
||||||
alignment = AlignmentType.Bottom;
|
alignment = AlignmentType.Bottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
positionY += config.LightfinderLabelOffsetY;
|
positionY += config.LightfinderLabelOffsetY;
|
||||||
|
|
||||||
alignment = (AlignmentType)System.Math.Clamp((int)alignment, 0, 8);
|
alignment = (AlignmentType)System.Math.Clamp((int)alignment, 0, 8);
|
||||||
|
|||||||
@@ -1254,7 +1254,8 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
|||||||
var selected = i == _lightfinderIconPresetIndex;
|
var selected = i == _lightfinderIconPresetIndex;
|
||||||
if (ImGui.Selectable(preview, selected))
|
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);
|
_lightfinderIconInput = NameplateHandler.ToIconEditorString(normalizedGlyph);
|
||||||
_lightfinderIconPresetIndex = presetIndex;
|
_lightfinderIconPresetIndex = presetIndex;
|
||||||
_lightfinderIconInputInitialized = true;
|
_lightfinderIconInputInitialized = true;
|
||||||
|
ImGui.SetKeyboardFocusHere(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawSettingsContent()
|
private void DrawSettingsContent()
|
||||||
|
|||||||
Reference in New Issue
Block a user