From d65718db85aa2d80f5dc6be6463151083d34c52f Mon Sep 17 00:00:00 2001 From: frizzle101101 Date: Wed, 23 Nov 2022 16:14:11 -0500 Subject: [PATCH] fix int sliders to fill the window like float sliders (#1984) * fix int sliders to fill the window like float sliders * add a spacer to make it consistent with float slider * add a spacer to make it consistent with float slider * adding pop width further constancy with float slider --- soh/soh/UIWidgets.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/soh/soh/UIWidgets.cpp b/soh/soh/UIWidgets.cpp index db47946bb..2ad9026ab 100644 --- a/soh/soh/UIWidgets.cpp +++ b/soh/soh/UIWidgets.cpp @@ -285,6 +285,7 @@ namespace UIWidgets { } ImGui::Text(text, val); + Spacer(0); if (disabled) { DisableComponentSwitch(disabledTooltipText, alpha); @@ -305,13 +306,23 @@ namespace UIWidgets { DisableComponentSwitch(disabledTooltipText, alpha); } } - + if (PlusMinusButton) { +#ifdef __SWITCH__ + ImGui::PushItemWidth(ImGui::GetWindowSize().x - 110.0f); +#elif defined(__WIIU__) + ImGui::PushItemWidth(ImGui::GetWindowSize().x - 79.0f * 2); +#else + ImGui::PushItemWidth(ImGui::GetWindowSize().x - 79.0f); +#endif + } if (ImGui::SliderInt(id, &val, min, max, format)) { CVar_SetS32(cvarName, val); SohImGui::RequestCvarSaveOnNextTick(); } - + if (PlusMinusButton) { + ImGui::PopItemWidth(); + } if(PlusMinusButton) { if (disabled) { DisableComponentSwitch(disabledTooltipText, alpha); @@ -364,9 +375,7 @@ namespace UIWidgets { } else { ImGui::Text(text, static_cast(100 * val)); } - Spacer(0); - if(PlusMinusButton) { std::string MinusBTNName = " - ##"; MinusBTNName += cvarName;