瀏覽代碼

Fix ColorPicker always emitting color_changed on html submit

The color change was always emitted when the the modal was closed, even if it was exactly the same as before.
Micky 3 年之前
父節點
當前提交
544727ac1e
共有 1 個文件被更改,包括 5 次插入2 次删除
  1. 5 2
      scene/gui/color_picker.cpp

+ 5 - 2
scene/gui/color_picker.cpp

@@ -427,12 +427,15 @@ void ColorPicker::_html_submitted(const String &p_html) {
 		return;
 	}
 
-	float last_alpha = color.a;
+	Color previous_color = color;
 	color = Color::html(p_html);
 	if (!is_editing_alpha()) {
-		color.a = last_alpha;
+		color.a = previous_color.a;
 	}
 
+	if (color == previous_color) {
+		return;
+	}
 	if (!is_inside_tree()) {
 		return;
 	}