From fe1f8443a411c64eb8a2934512ab982f3df3d550 Mon Sep 17 00:00:00 2001 From: Phnix <76911907+MrPhnix@users.noreply.github.com> Date: Sat, 27 Aug 2022 18:55:58 +0200 Subject: [PATCH] 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> --- scene/gui/range.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp index 0fb1f27802e3..2b8a6e60c972 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) {