From 4d8331ad1f85f16c179d27fd4f52f36b37e76ae8 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Mon, 10 Apr 2023 20:49:30 +0200 Subject: [PATCH] Round values to 3 decimals in the ColorPicker constructor string This makes the whole string always fit within the LineEdit (at least when using the default font). --- scene/gui/color_picker.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index 23b5bb2c7bd..4d90c8a367e 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -966,9 +966,9 @@ bool ColorPicker::is_deferred_mode() const { void ColorPicker::_update_text_value() { bool text_visible = true; if (text_is_constructor) { - String t = "Color(" + String::num(color.r) + ", " + String::num(color.g) + ", " + String::num(color.b); + String t = "Color(" + String::num(color.r, 3) + ", " + String::num(color.g, 3) + ", " + String::num(color.b, 3); if (edit_alpha && color.a < 1) { - t += ", " + String::num(color.a) + ")"; + t += ", " + String::num(color.a, 3) + ")"; } else { t += ")"; }