1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-11-13 18:50:58 +01:00

Nav / Slider: Fixed reaching edge of integer slider with navigation input, bug introduced on January 25 in Nav branch 10a4a77b27. (#787)

This commit is contained in:
omar 2018-02-01 00:08:13 +01:00
parent eaa6f490a2
commit 7b22a91578

View File

@ -8457,10 +8457,11 @@ bool ImGui::SliderBehavior(const ImRect& frame_bb, ImGuiID id, float* v, float v
} }
if (IsNavInputDown(ImGuiNavInput_PadTweakFast)) if (IsNavInputDown(ImGuiNavInput_PadTweakFast))
delta *= 10.0f; delta *= 10.0f;
clicked_t = ImSaturate(clicked_t + delta);
set_new_value = true; set_new_value = true;
if ((clicked_t >= 1.0f && delta > 0.0f) || (clicked_t <= 0.0f && delta < 0.0f)) // This is to avoid applying the saturation when already past the limits if ((clicked_t >= 1.0f && delta > 0.0f) || (clicked_t <= 0.0f && delta < 0.0f)) // This is to avoid applying the saturation when already past the limits
set_new_value = false; set_new_value = false;
else
clicked_t = ImSaturate(clicked_t + delta);
} }
} }
else else