Skip to content

Commit

Permalink
SliderInt, SliderFloat(): support reverse direction (#854)
Browse files Browse the repository at this point in the history
  • Loading branch information
ocornut committed Nov 27, 2016
1 parent 104b381 commit 61d5b46
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6539,10 +6539,10 @@ bool ImGui::SliderBehavior(const ImRect& frame_bb, ImGuiID id, float* v, float v
}

// Calculate slider grab positioning
float v_clamped = (v_min < v_max) ? ImClamp(*v, v_min, v_max) : ImClamp(*v, v_max, v_min);
float grab_t;
if (is_non_linear)
{
float v_clamped = ImClamp(*v, v_min, v_max);
if (v_clamped < 0.0f)
{
const float f = 1.0f - (v_clamped - v_min) / (ImMin(0.0f,v_max) - v_min);
Expand All @@ -6557,7 +6557,7 @@ bool ImGui::SliderBehavior(const ImRect& frame_bb, ImGuiID id, float* v, float v
else
{
// Linear slider
grab_t = (ImClamp(*v, v_min, v_max) - v_min) / (v_max - v_min);
grab_t = (v_clamped - v_min) / (v_max - v_min);
}

// Draw
Expand Down

0 comments on commit 61d5b46

Please sign in to comment.