From 544727ac1ea7616c9f44116360d038cfcda5f763 Mon Sep 17 00:00:00 2001 From: Micky Date: Sat, 24 Sep 2022 15:43:41 +0200 Subject: [PATCH] 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. --- scene/gui/color_picker.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index 4a1f2ab7c65..5751c548777 100644 --- a/scene/gui/color_picker.cpp +++ b/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; }