Sfoglia il codice sorgente

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]>
(cherry picked from commit fe1f8443a411c64eb8a2934512ab982f3df3d550)
Phnix 3 anni fa
parent
commit
9ac09dfb64
1 ha cambiato i file con 1 aggiunte e 1 eliminazioni
  1. 1 1
      scene/gui/range.cpp

+ 1 - 1
scene/gui/range.cpp

@@ -78,7 +78,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) {