diff options
author | Emmanuel Barroga <emmanuelbarroga@gmail.com> | 2019-08-09 01:10:05 -0700 |
---|---|---|
committer | Emmanuel Barroga <emmanuelbarroga@gmail.com> | 2019-08-09 01:47:20 -0700 |
commit | 2e1b58c79337a31e7293c120933b1ceab0d2fd1d (patch) | |
tree | fd237159e21a94b0e0c4f0940825d0d1f3db3129 /scene/gui | |
parent | 6bb2717005e4e3f3a5ca230b02089d624d155c34 (diff) |
Fix Exponential Range Graphical Error
Fixes the Exponential Range Slider having a graphical error with less than 1 values.
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/range.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp index e709bac377..ed5dd77f53 100644 --- a/scene/gui/range.cpp +++ b/scene/gui/range.cpp @@ -180,12 +180,12 @@ double Range::get_as_ratio() const { float value = CLAMP(get_value(), shared->min, shared->max); double v = Math::log(value) / Math::log((double)2); - return (v - exp_min) / (exp_max - exp_min); + return CLAMP((v - exp_min) / (exp_max - exp_min), 0, 1); } else { float value = CLAMP(get_value(), shared->min, shared->max); - return (value - get_min()) / (get_max() - get_min()); + return CLAMP((value - get_min()) / (get_max() - get_min()), 0, 1); } } |