diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-09-28 10:38:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-28 10:38:33 +0200 |
commit | a5017f925f32c0bf8730f50c08ffc8d4ec1b7794 (patch) | |
tree | 084ac131420656053630b4b2a74b1aaabda59e26 | |
parent | f87fb2c795f93fa4171c8ab0b6a5af49b013dcd7 (diff) | |
parent | 98395f652c285a4c661a634a98fb9d63345c8a7b (diff) |
Merge pull request #22405 from DualMatrix/better_step
Fixed step value not being respected for ranges in some cases.
-rw-r--r-- | scene/gui/range.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
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; |