From 9a0dfafb85c800eceb86f93a5fb63570221ead4d Mon Sep 17 00:00:00 2001 From: Liza Carvelli Date: Wed, 27 Mar 2024 18:29:49 +0100 Subject: [PATCH] Fix UI scaling issues --- Deliveroo/Deliveroo.csproj | 2 +- Deliveroo/Windows/ConfigWindow.cs | 13 +++++++------ Deliveroo/Windows/TurnInWindow.cs | 13 ++++++++++--- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/Deliveroo/Deliveroo.csproj b/Deliveroo/Deliveroo.csproj index 9e4a92e..d4545f4 100644 --- a/Deliveroo/Deliveroo.csproj +++ b/Deliveroo/Deliveroo.csproj @@ -1,7 +1,7 @@ net8.0-windows - 4.0 + 4.1 12 enable true diff --git a/Deliveroo/Windows/ConfigWindow.cs b/Deliveroo/Windows/ConfigWindow.cs index d6b42a6..d0540b0 100644 --- a/Deliveroo/Windows/ConfigWindow.cs +++ b/Deliveroo/Windows/ConfigWindow.cs @@ -89,9 +89,9 @@ internal sealed class ConfigWindow : LWindow IDalamudTextureWrap? icon = _iconCache.GetIcon(item.IconId); if (icon != null) { - ImGui.Image(icon.ImGuiHandle, new Vector2(23, 23)); + ImGui.Image(icon.ImGuiHandle, new Vector2(ImGui.GetFrameHeight())); ImGui.SameLine(); - ImGui.SetCursorPosY(ImGui.GetCursorPosY() + 3); + ImGui.SetCursorPosY(ImGui.GetCursorPosY() + ImGui.GetStyle().FramePadding.X); } ImGui.Selectable($"{item.Name}{(item.Limited ? $" {SeIconChar.Hyadelyn.ToIconString()}" : "")}"); @@ -166,9 +166,9 @@ internal sealed class ConfigWindow : LWindow IDalamudTextureWrap? icon = _iconCache.GetIcon(item.IconId); if (icon != null) { - ImGui.Image(icon.ImGuiHandle, new Vector2(23, 23)); + ImGui.Image(icon.ImGuiHandle, new Vector2(ImGui.GetFrameHeight())); ImGui.SameLine(); - ImGui.SetCursorPosY(ImGui.GetCursorPosY() + 3); + ImGui.SetCursorPosY(ImGui.GetCursorPosY() + ImGui.GetStyle().FramePadding.X); } bool addThis = @@ -329,7 +329,8 @@ internal sealed class ConfigWindow : LWindow if (reserveDifferentSealCountAtMaxRank) { - ImGui.Indent(); + float indentSize = ImGui.GetFrameHeight() + ImGui.GetStyle().ItemInnerSpacing.X; + ImGui.Indent(indentSize); ImGui.SetNextItemWidth(ImGuiHelpers.GlobalScale * 100); int reservedSealCountAtMaxRank = _configuration.ReservedSealCountAtMaxRank; if (ImGui.InputInt("Minimum seals to keep at max rank", ref reservedSealCountAtMaxRank)) @@ -339,7 +340,7 @@ internal sealed class ConfigWindow : LWindow Save(); } - ImGui.Unindent(); + ImGui.Unindent(indentSize); } ImGui.EndDisabled(); diff --git a/Deliveroo/Windows/TurnInWindow.cs b/Deliveroo/Windows/TurnInWindow.cs index 3bd0413..93732c4 100644 --- a/Deliveroo/Windows/TurnInWindow.cs +++ b/Deliveroo/Windows/TurnInWindow.cs @@ -49,6 +49,7 @@ internal sealed class TurnInWindow : LWindow private readonly ICondition _condition; private readonly IClientState _clientState; private readonly GcRewardsCache _gcRewardsCache; + private readonly ConfigWindow _configWindow; private readonly IconCache _iconCache; private bool _state; @@ -64,6 +65,7 @@ internal sealed class TurnInWindow : LWindow _condition = condition; _clientState = clientState; _gcRewardsCache = gcRewardsCache; + _configWindow = configWindow; _iconCache = iconCache; Position = new Vector2(100, 100); @@ -200,7 +202,8 @@ internal sealed class TurnInWindow : LWindow State = state; } - ImGui.Indent(27); + float indentSize = ImGui.GetFrameHeight() + ImGui.GetStyle().ItemInnerSpacing.X; + ImGui.Indent(indentSize); if (!string.IsNullOrEmpty(Error)) { ImGui.TextColored(ImGuiColors.DalamudRed, Error); @@ -240,7 +243,7 @@ internal sealed class TurnInWindow : LWindow } } - ImGui.Unindent(27); + ImGui.Unindent(indentSize); ImGui.Separator(); ImGui.BeginDisabled(state); @@ -352,7 +355,7 @@ internal sealed class TurnInWindow : LWindow IDalamudTextureWrap? icon = _iconCache.GetIcon(comboItem.Item.IconId); if (icon != null) { - ImGui.Image(icon.ImGuiHandle, new Vector2(23, 23)); + ImGui.Image(icon.ImGuiHandle, new Vector2(ImGui.GetFrameHeight())); ImGui.SameLine(0, 3); } @@ -475,6 +478,10 @@ internal sealed class TurnInWindow : LWindow ImGui.EndPopup(); } + + ImGui.SameLine(); + if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.Cog, "Configure available Items")) + _configWindow.IsOpen = true; } }