Ver código fonte

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 <[email protected]>
Phnix 3 anos atrás
pai
commit
fe1f8443a4
1 arquivos alterados com 1 adições e 1 exclusões
  1. 1 1
      scene/gui/range.cpp

+ 1 - 1
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) {