From 67c6d6026a14b70ed619da79b19b3d2565fc0c05 Mon Sep 17 00:00:00 2001 From: ocornut Date: Sun, 27 Nov 2016 18:29:38 +0100 Subject: [PATCH] Nav: SliderFloat() Fixed non-linear sliders in Nav branch (#787, #323) --- imgui.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 68bd0ad2b..fffedf2e4 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -7339,7 +7339,7 @@ float ImGui::RoundScalar(float value, int decimal_precision) static inline float SliderBehaviorCalcRatioFromValue(float v, float v_min, float v_max, float power, float linear_zero_pos) { - const bool is_non_linear = (power < 1.0f-0.00001f) && (power > 1.0f-0.00001f); + const bool is_non_linear = (power < 1.0f-0.00001f) || (power > 1.0f+0.00001f); const float v_clamped = (v_min < v_max) ? ImClamp(v, v_min, v_max) : ImClamp(v, v_max, v_min); if (is_non_linear) { @@ -7370,7 +7370,7 @@ bool ImGui::SliderBehavior(const ImRect& frame_bb, ImGuiID id, float* v, float v RenderNavHighlight(frame_bb, id); RenderFrame(frame_bb.Min, frame_bb.Max, frame_col, true, style.FrameRounding); - const bool is_non_linear = (power < 1.0f-0.00001f) && (power > 1.0f-0.00001f); + const bool is_non_linear = (power < 1.0f-0.00001f) || (power > 1.0f+0.00001f); const bool is_horizontal = (flags & ImGuiSliderFlags_Vertical) == 0; const float grab_padding = 2.0f;