From 448d792988d570849ec22e526055fc33728b7d28 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Mon, 20 Nov 2023 21:40:54 +0100 Subject: [PATCH] fix: Centered text not being centered correctly --- lib/libimhex/include/hex/ui/imgui_imhex_extensions.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libimhex/include/hex/ui/imgui_imhex_extensions.h b/lib/libimhex/include/hex/ui/imgui_imhex_extensions.h index 831f725f4..a04a6dcde 100644 --- a/lib/libimhex/include/hex/ui/imgui_imhex_extensions.h +++ b/lib/libimhex/include/hex/ui/imgui_imhex_extensions.h @@ -232,7 +232,7 @@ namespace ImGuiExt { inline void TextFormattedCentered(const std::string &fmt, auto &&...args) { auto text = hex::format(fmt, std::forward(args)...); auto availableSpace = ImGui::GetContentRegionAvail(); - auto textSize = ImGui::CalcTextSize(text.c_str(), nullptr, false); + auto textSize = ImGui::CalcTextSize(text.c_str(), nullptr, false, availableSpace.x * 0.75F); ImGui::SetCursorPos(((availableSpace - textSize) / 2.0F)); @@ -244,7 +244,7 @@ namespace ImGuiExt { inline void TextFormattedCenteredHorizontal(const std::string &fmt, auto &&...args) { auto text = hex::format(fmt, std::forward(args)...); auto availableSpace = ImGui::GetContentRegionAvail(); - auto textSize = ImGui::CalcTextSize(text.c_str(), nullptr, false); + auto textSize = ImGui::CalcTextSize(text.c_str(), nullptr, false, availableSpace.x * 0.75F); ImGui::SetCursorPosX(((availableSpace - textSize) / 2.0F).x);