mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 21:24:16 +01:00
feat: ImGuiHelpers.GetButtonSize()
This commit is contained in:
parent
59ba3bdd07
commit
b779ac5674
2 changed files with 9 additions and 4 deletions
|
|
@ -105,6 +105,13 @@ namespace Dalamud.Interface
|
|||
return colorPalette;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the size of a button considering the default frame padding.
|
||||
/// </summary>
|
||||
/// <param name="text">Text in the button.</param>
|
||||
/// <returns><see cref="Vector2"/> with the size of the button.</returns>
|
||||
public static Vector2 GetButtonSize(string text) => ImGui.CalcTextSize(text) + (ImGui.GetStyle().FramePadding * 2);
|
||||
|
||||
/// <summary>
|
||||
/// Get data needed for each new frame.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -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<PluginManager>.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))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue