You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-12 13:20:55 +00:00
Fix Exponential Range Graphical Error
Fixes the Exponential Range Slider having a graphical error with less than 1 values.
This commit is contained in:
@@ -180,12 +180,12 @@ double Range::get_as_ratio() const {
|
|||||||
float value = CLAMP(get_value(), shared->min, shared->max);
|
float value = CLAMP(get_value(), shared->min, shared->max);
|
||||||
double v = Math::log(value) / Math::log((double)2);
|
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 {
|
} else {
|
||||||
|
|
||||||
float value = CLAMP(get_value(), shared->min, shared->max);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user