Browse Source

Merge pull request #22405 from DualMatrix/better_step

Fixed step value not being respected for ranges in some cases.
Rémi Verschelde 7 years ago
parent
commit
a5017f925f
1 changed files with 3 additions and 2 deletions
  1. 3 2
      scene/gui/range.cpp

+ 3 - 2
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;