fix some scaling issues

This commit is contained in:
Stanley Dimant 2025-02-23 12:54:46 +01:00
parent 6d355d9b90
commit 286ef6d810
2 changed files with 40 additions and 30 deletions

View file

@ -1098,7 +1098,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
{
if (expectedWidth != null)
{
ImGuiHelpers.ScaledDummy(expectedWidth.Value, 0);
ImGui.Dummy(new(expectedWidth.Value, 0));
ImGui.SetCursorPos(cursorPos);
}
@ -1115,12 +1115,22 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
{
var availWidth = ImGui.GetContentRegionAvail().X;
var textWidth = ImGui.CalcTextSize(text, availWidth).X;
if (maxWidth != null && textWidth > maxWidth) textWidth = maxWidth.Value;
if (maxWidth != null && textWidth > maxWidth * ImGuiHelpers.GlobalScale) textWidth = maxWidth.Value * ImGuiHelpers.GlobalScale;
ImGui.SetCursorPosX(ImGui.GetCursorPosX() + (availWidth / 2f) - (textWidth / 2f));
DrawGrouped(() =>
{
ColorTextWrapped(text, color, ImGui.GetCursorPosX() + textWidth);
}, expectedWidth: maxWidth == null ? null : maxWidth);
}, expectedWidth: maxWidth == null ? null : maxWidth * ImGuiHelpers.GlobalScale);
}
public static void ScaledSameLine(float offset)
{
ImGui.SameLine(offset * ImGuiHelpers.GlobalScale);
}
public static void ScaledNextItemWidth(float width)
{
ImGui.SetNextItemWidth(width * ImGuiHelpers.GlobalScale);
}
internal static void DistanceSeparator()