From 4b9f50add0e41170348cf91e54970ef4306a9c43 Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Thu, 21 Mar 2024 21:23:05 -0500 Subject: [PATCH] Fix carrot and selection height based on dpi scale to correctly scale with interface options. --- Source/Engine/UI/GUI/Common/TextBox.cs | 8 ++++---- Source/Engine/UI/GUI/Common/TextBoxBase.cs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/Engine/UI/GUI/Common/TextBox.cs b/Source/Engine/UI/GUI/Common/TextBox.cs index ec44a3ca8..4409d7b85 100644 --- a/Source/Engine/UI/GUI/Common/TextBox.cs +++ b/Source/Engine/UI/GUI/Common/TextBox.cs @@ -181,7 +181,7 @@ namespace FlaxEngine.GUI if (selectedLinesCount == 1) { // Selected is part of single line - Rectangle r1 = new Rectangle(leftEdge.X, leftEdge.Y, rightEdge.X - leftEdge.X, fontHeight); + Rectangle r1 = new Rectangle(leftEdge.X, leftEdge.Y, rightEdge.X - leftEdge.X, fontHeight * DpiScale); Render2D.FillRectangle(r1, selectionColor); } else @@ -189,17 +189,17 @@ namespace FlaxEngine.GUI float leftMargin = _layout.Bounds.Location.X; // Selected is more than one line - Rectangle r1 = new Rectangle(leftEdge.X, leftEdge.Y, 1000000000, fontHeight); + Rectangle r1 = new Rectangle(leftEdge.X, leftEdge.Y, 1000000000, fontHeight * DpiScale); Render2D.FillRectangle(r1, selectionColor); // for (int i = 3; i <= selectedLinesCount; i++) { leftEdge.Y += fontHeight; - Rectangle r = new Rectangle(leftMargin, leftEdge.Y, 1000000000, fontHeight); + Rectangle r = new Rectangle(leftMargin, leftEdge.Y, 1000000000, fontHeight * DpiScale); Render2D.FillRectangle(r, selectionColor); } // - Rectangle r2 = new Rectangle(leftMargin, rightEdge.Y, rightEdge.X - leftMargin, fontHeight); + Rectangle r2 = new Rectangle(leftMargin, rightEdge.Y, rightEdge.X - leftMargin, fontHeight * DpiScale); Render2D.FillRectangle(r2, selectionColor); } } diff --git a/Source/Engine/UI/GUI/Common/TextBoxBase.cs b/Source/Engine/UI/GUI/Common/TextBoxBase.cs index c22099011..a7393a121 100644 --- a/Source/Engine/UI/GUI/Common/TextBoxBase.cs +++ b/Source/Engine/UI/GUI/Common/TextBoxBase.cs @@ -474,7 +474,7 @@ namespace FlaxEngine.GUI caretPos.X - (caretWidth * 0.5f), caretPos.Y, caretWidth, - height); + height * DpiScale); } }