瀏覽代碼

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 年之前
父節點
當前提交
9ac09dfb64
共有 1 個文件被更改,包括 1 次插入1 次删除
  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) {