From 08791dd6c2db3b900c65940d689b84b92bcff557 Mon Sep 17 00:00:00 2001 From: harlanx Date: Tue, 30 Aug 2022 13:51:02 +0800 Subject: [PATCH] clamp slider input value --- cheat-base/src/cheat-base/render/gui-util.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cheat-base/src/cheat-base/render/gui-util.cpp b/cheat-base/src/cheat-base/render/gui-util.cpp index cb299c0..fa52135 100644 --- a/cheat-base/src/cheat-base/render/gui-util.cpp +++ b/cheat-base/src/cheat-base/render/gui-util.cpp @@ -78,7 +78,7 @@ bool TypeWidget(const char* label, int& value, int step, int start, int end, con if (start == end) result = ImGui::InputInt(label, &value, step); else - result = ImGui::DragInt(label, &value, (float)step, start, end); + result = ImGui::DragInt(label, &value, (float)step, start, end, nullptr, ImGuiSliderFlags_AlwaysClamp); END_TYPE_WIDGET(); } @@ -90,7 +90,7 @@ bool TypeWidget(const char* label, float& value, float step, float start, float if (start == end) result = ImGui::InputFloat(label, &value, step); else - result = ImGui::DragFloat(label, &value, step, start, end); + result = ImGui::DragFloat(label, &value, step, start, end, nullptr, ImGuiSliderFlags_AlwaysClamp); END_TYPE_WIDGET(); }