Skip to content

Commit 94c77ed

Browse files
committed
SliderInt, SliderFloat() Better display support for v_min==v_max range. (ocornut#919)
1 parent 0a48337 commit 94c77ed

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

imgui.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6448,6 +6448,9 @@ float ImGui::RoundScalar(float value, int decimal_precision)
64486448

64496449
static inline float SliderBehaviorCalcRatioFromValue(float v, float v_min, float v_max, float power, float linear_zero_pos)
64506450
{
6451+
if (v_min == v_max)
6452+
return 0.0f;
6453+
64516454
const bool is_non_linear = (power < 1.0f-0.00001f) || (power > 1.0f+0.00001f);
64526455
const float v_clamped = (v_min < v_max) ? ImClamp(v, v_min, v_max) : ImClamp(v, v_max, v_min);
64536456
if (is_non_linear)

0 commit comments

Comments
 (0)