diff options
author | Phnix <76911907+MrPhnix@users.noreply.github.com> | 2022-08-27 18:55:58 +0200 |
---|---|---|
committer | Phnix <76911907+MrPhnix@users.noreply.github.com> | 2022-08-27 18:55:58 +0200 |
commit | fe1f8443a411c64eb8a2934512ab982f3df3d550 (patch) | |
tree | 99f67b87d1dccaa61fca899611f33501b7611c6d | |
parent | 09086b0bb08808de3c1eb257ed7a83b0a0a61f8f (diff) |
incorrect range value with min value and step
If the minimum value and the steps are greater than 0, the value will not be calculated correctly.
Co-Authored-By: Astral-Sheep <109028693+Astral-Sheep@users.noreply.github.com>
-rw-r--r-- | scene/gui/range.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp index 0fb1f27802..2b8a6e60c9 100644 --- a/scene/gui/range.cpp +++ b/scene/gui/range.cpp @@ -81,7 +81,7 @@ void Range::Shared::emit_changed(const char *p_what) { void Range::set_value(double p_val) { if (shared->step > 0) { - p_val = Math::round(p_val / shared->step) * shared->step; + p_val = Math::round((p_val - shared->min) / shared->step) * shared->step + shared->min; } if (_rounded_values) { |