From 98395f652c285a4c661a634a98fb9d63345c8a7b Mon Sep 17 00:00:00 2001 From: DualMatrix Date: Mon, 24 Sep 2018 18:09:00 +0200 Subject: Fixed step value not being respected for ranges in some cases. Fixed step value not being respected for ranges in some cases. --- scene/gui/range.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'scene/gui') diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp index 09d8664240..8fe33a00fb 100644 --- a/scene/gui/range.cpp +++ b/scene/gui/range.cpp @@ -66,10 +66,11 @@ 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; - if (_rounded_values) { + if (_rounded_values) p_val = Math::round(p_val); - } if (!shared->allow_greater && p_val > shared->max - shared->page) p_val = shared->max - shared->page; -- cgit v1.2.3