mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
SliderInt, SliderFloat() Better display support for v_min==v_max range. (#919)
This commit is contained in:
parent
0a483379af
commit
94c77edfa5
@ -6448,6 +6448,9 @@ 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)
|
static inline float SliderBehaviorCalcRatioFromValue(float v, float v_min, float v_max, float power, float linear_zero_pos)
|
||||||
{
|
{
|
||||||
|
if (v_min == v_max)
|
||||||
|
return 0.0f;
|
||||||
|
|
||||||
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);
|
const float v_clamped = (v_min < v_max) ? ImClamp(v, v_min, v_max) : ImClamp(v, v_max, v_min);
|
||||||
if (is_non_linear)
|
if (is_non_linear)
|
||||||
|
Loading…
Reference in New Issue
Block a user