Skip to content

Commit

Permalink
Fix imgui rounding operation that caused range boundary override
Browse files Browse the repository at this point in the history
Change-Id: I8bebb33e36bf8aa429c05f77975df9db1c71a8f1
  • Loading branch information
ev-mp committed Apr 8, 2021
1 parent df2c793 commit ac9596e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion third-party/imgui/imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6455,10 +6455,12 @@ bool ImGui::SliderBehavior(const ImRect& frame_bb, ImGuiID id, float* v, float v
new_value = ImLerp(v_min, v_max, normalized_pos);
}

// Round past decimal precision
// Round past decimal precision, verify that it remains within min/max range
new_value = RoundScalar(new_value, decimal_precision);
if (*v != new_value)
{
if (new_value >v_max ) new_value = v_max;
if (new_value < v_min) new_value = v_min;
*v = new_value;
value_changed = true;
}
Expand Down

0 comments on commit ac9596e

Please sign in to comment.