diff --git a/Dalamud/Interface/ImGuiHelpers.cs b/Dalamud/Interface/ImGuiHelpers.cs index 52c9802f9..f138cdf40 100644 --- a/Dalamud/Interface/ImGuiHelpers.cs +++ b/Dalamud/Interface/ImGuiHelpers.cs @@ -105,6 +105,13 @@ namespace Dalamud.Interface return colorPalette; } + /// + /// Get the size of a button considering the default frame padding. + /// + /// Text in the button. + /// with the size of the button. + public static Vector2 GetButtonSize(string text) => ImGui.CalcTextSize(text) + (ImGui.GetStyle().FramePadding * 2); + /// /// Get data needed for each new frame. /// diff --git a/Dalamud/Interface/Internal/Windows/PluginInstallerWindow.cs b/Dalamud/Interface/Internal/Windows/PluginInstallerWindow.cs index 7318badbe..c7fc934a1 100644 --- a/Dalamud/Interface/Internal/Windows/PluginInstallerWindow.cs +++ b/Dalamud/Interface/Internal/Windows/PluginInstallerWindow.cs @@ -201,8 +201,6 @@ namespace Dalamud.Interface.Internal.Windows this.DownloadPluginIcons(); } - private static Vector2 GetButtonSize(string text) => ImGui.CalcTextSize(text) + (ImGui.GetStyle().FramePadding * 2); - private static string? GetPluginIconUrl(PluginManifest manifest, bool isThirdParty, bool isTesting) { if (isThirdParty) @@ -286,7 +284,7 @@ namespace Dalamud.Interface.Internal.Windows var pluginManager = Service.Get(); var windowSize = ImGui.GetWindowContentRegionMax(); - var placeholderButtonSize = GetButtonSize("placeholder"); + var placeholderButtonSize = ImGuiHelpers.GetButtonSize("placeholder"); ImGui.Separator(); @@ -311,7 +309,7 @@ namespace Dalamud.Interface.Internal.Windows } var closeText = Locs.FooterButton_Close; - var closeButtonSize = GetButtonSize(closeText); + var closeButtonSize = ImGuiHelpers.GetButtonSize(closeText); ImGui.SameLine(windowSize.X - closeButtonSize.X - 20); if (ImGui.Button(closeText))