From f2e4fe300b5fc786a29389cfd6fe0d80493702f8 Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Tue, 31 Dec 2024 12:56:43 -0600 Subject: [PATCH] Change color for readonly text. Fix selection still showing when text box is not focused. --- Source/Engine/UI/GUI/Common/TextBox.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Source/Engine/UI/GUI/Common/TextBox.cs b/Source/Engine/UI/GUI/Common/TextBox.cs index da8b299cb..64e8e1869 100644 --- a/Source/Engine/UI/GUI/Common/TextBox.cs +++ b/Source/Engine/UI/GUI/Common/TextBox.cs @@ -249,7 +249,7 @@ namespace FlaxEngine.GUI var text = ConvertedText(); // Check if sth is selected to draw selection - if (HasSelection) + if (HasSelection && IsFocused) { var leftEdge = font.GetCharPosition(text, SelectionLeft, ref _layout); var rightEdge = font.GetCharPosition(text, SelectionRight, ref _layout); @@ -294,6 +294,8 @@ namespace FlaxEngine.GUI var color = TextColor; if (!enabled) color *= 0.6f; + else if (_isReadOnly) + color *= 0.85f; Render2D.DrawText(font, text, color, ref _layout, TextMaterial); } else if (!string.IsNullOrEmpty(_watermarkText))