diff --git a/Source/Engine/UI/GUI/Common/RichTextBoxBase.cs b/Source/Engine/UI/GUI/Common/RichTextBoxBase.cs index 7722fc94b..ff94a73f0 100644 --- a/Source/Engine/UI/GUI/Common/RichTextBoxBase.cs +++ b/Source/Engine/UI/GUI/Common/RichTextBoxBase.cs @@ -379,6 +379,9 @@ namespace FlaxEngine.GUI var leftEdge = selection.StartIndex <= textBlock.Range.StartIndex ? textBlock.Bounds.UpperLeft : GetCharPosition(selection.StartIndex, out _); var rightEdge = selection.EndIndex >= textBlock.Range.EndIndex ? textBlock.Bounds.UpperRight : GetCharPosition(selection.EndIndex, out _); float height = font.Height; +#if PLATFORM_MAC && !PLATFORM_SDL + height /= (float)Platform.Dpi / 96.0f; // TODO: refactor DPI support on macOS to skip such hacks +#endif float alpha = Mathf.Min(1.0f, Mathf.Cos(_animateTime * BackgroundSelectedFlashSpeed) * 0.5f + 1.3f); alpha *= alpha; Color selectionColor = Color.White * alpha; diff --git a/Source/Engine/UI/GUI/Common/TextBox.cs b/Source/Engine/UI/GUI/Common/TextBox.cs index 3d7099db6..1346a8c2b 100644 --- a/Source/Engine/UI/GUI/Common/TextBox.cs +++ b/Source/Engine/UI/GUI/Common/TextBox.cs @@ -253,8 +253,11 @@ namespace FlaxEngine.GUI { var leftEdge = font.GetCharPosition(text, SelectionLeft, ref _layout); var rightEdge = font.GetCharPosition(text, SelectionRight, ref _layout); - var fontHeight = font.Height; - var textHeight = fontHeight / DpiScale; + float fontHeight = font.Height; +#if PLATFORM_MAC && !PLATFORM_SDL + fontHeight /= (float)Platform.Dpi / 96.0f; // TODO: refactor DPI support on macOS to skip such hacks +#endif + float textHeight = fontHeight / DpiScale; // Draw selection background float alpha = Mathf.Min(1.0f, Mathf.Cos(_animateTime * BackgroundSelectedFlashSpeed) * 0.5f + 1.3f); diff --git a/Source/Engine/UI/GUI/Common/TextBoxBase.cs b/Source/Engine/UI/GUI/Common/TextBoxBase.cs index 491fbcd94..415a3c9c8 100644 --- a/Source/Engine/UI/GUI/Common/TextBoxBase.cs +++ b/Source/Engine/UI/GUI/Common/TextBoxBase.cs @@ -556,6 +556,9 @@ namespace FlaxEngine.GUI { const float caretWidth = 1.2f; Float2 caretPos = GetCharPosition(CaretPosition, out var height); +#if PLATFORM_MAC && !PLATFORM_SDL + height /= (float)Platform.Dpi / 96.0f; // TODO: refactor DPI support on macOS to skip such hacks +#endif return new Rectangle( caretPos.X - (caretWidth * 0.5f), caretPos.Y,