Fix Dpi issues when RootWindow is null

Fix #344
This commit is contained in:
Wojtek Figat
2021-03-17 00:04:16 +01:00
parent 878fee505f
commit 691df4cb80
6 changed files with 16 additions and 11 deletions

View File

@@ -107,7 +107,7 @@ namespace FlaxEngine.GUI
return Vector2.Zero;
}
height = font.Height / RootWindow.DpiScale;
height = font.Height / DpiScale;
return font.GetCharPosition(_text, index, ref _layout);
}
@@ -159,7 +159,7 @@ namespace FlaxEngine.GUI
{
Vector2 leftEdge = font.GetCharPosition(_text, SelectionLeft, ref _layout);
Vector2 rightEdge = font.GetCharPosition(_text, SelectionRight, ref _layout);
float fontHeight = font.Height / RootWindow.DpiScale;
float fontHeight = font.Height / DpiScale;
// Draw selection background
float alpha = Mathf.Min(1.0f, Mathf.Cos(_animateTime * BackgroundSelectedFlashSpeed) * 0.5f + 1.3f);