summaryrefslogtreecommitdiffstats
path: root/scene/gui/color_picker.cpp
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2023-04-10 20:49:30 +0200
committerHugo Locurcio <hugo.locurcio@hugo.pro>2023-04-11 18:29:52 +0200
commit4d8331ad1f85f16c179d27fd4f52f36b37e76ae8 (patch)
treea400ace6a50480c34c8f78868f7cb8d8fe5eee48 /scene/gui/color_picker.cpp
parentc48219f51e3d33a56e8a142db0ec73a30df8fb91 (diff)
downloadredot-engine-4d8331ad1f85f16c179d27fd4f52f36b37e76ae8.tar.gz
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).
Diffstat (limited to 'scene/gui/color_picker.cpp')
-rw-r--r--scene/gui/color_picker.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp
index 23b5bb2c7b..4d90c8a367 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 += ")";
}