Fix TextBox caret and selection when using text alignment options
#2653
This commit is contained in:
@@ -291,24 +291,7 @@ namespace FlaxEngine.GUI
|
||||
{
|
||||
float alpha = Mathf.Saturate(Mathf.Cos(_animateTime * CaretFlashSpeed) * 0.5f + 0.7f);
|
||||
alpha = alpha * alpha * alpha * alpha * alpha * alpha;
|
||||
if (CaretPosition == 0)
|
||||
{
|
||||
var bounds = CaretBounds;
|
||||
if (_layout.VerticalAlignment == TextAlignment.Center)
|
||||
bounds.Y = _layout.Bounds.Y + _layout.Bounds.Height * 0.5f - bounds.Height * 0.5f;
|
||||
else if (_layout.VerticalAlignment == TextAlignment.Far)
|
||||
bounds.Y = _layout.Bounds.Y + _layout.Bounds.Height - bounds.Height;
|
||||
|
||||
if (_layout.HorizontalAlignment == TextAlignment.Center)
|
||||
bounds.X = _layout.Bounds.X + _layout.Bounds.Width * 0.5f - bounds.Width * 0.5f;
|
||||
else if (_layout.HorizontalAlignment == TextAlignment.Far)
|
||||
bounds.X = _layout.Bounds.X + _layout.Bounds.Width - bounds.Width;
|
||||
Render2D.FillRectangle(bounds, CaretColor * alpha);
|
||||
}
|
||||
else
|
||||
{
|
||||
Render2D.FillRectangle(CaretBounds, CaretColor * alpha);
|
||||
}
|
||||
Render2D.FillRectangle(CaretBounds, CaretColor * alpha);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user