Merge pull request #31230 from sparkart/fix_unclamped_exp_range

Fix Exponential Range Graphical Error
This commit is contained in:
Rémi Verschelde 2019-08-09 11:18:16 +02:00 committed by GitHub
commit 432ef8e486
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);
}
}