1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-11 13:10:58 +00:00

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).
This commit is contained in:
Hugo Locurcio
2023-04-10 20:49:30 +02:00
parent c48219f51e
commit 4d8331ad1f

View File

@@ -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 += ")";
}