Browse Source

Merge pull request #5853 from Gillibald/fixes/TextBlockHorizontalAlignment

Fix TextAlignment for TextBlock when HorizontalAlignment is used.
# Conflicts:
#	src/Avalonia.Visuals/Media/TextFormatting/TextLayout.cs
release/0.10.3
Benedikt Stebner 6 years ago
committed by Dan Walmsley
parent
commit
cb24755a56
  1. 6
      src/Avalonia.Visuals/Media/TextFormatting/TextLayout.cs

6
src/Avalonia.Visuals/Media/TextFormatting/TextLayout.cs

@ -166,9 +166,11 @@ namespace Avalonia.Media.TextFormatting
/// <param name="height">The current height.</param> /// <param name="height">The current height.</param>
private static void UpdateBounds(TextLine textLine, ref double width, ref double height) private static void UpdateBounds(TextLine textLine, ref double width, ref double height)
{ {
if (width < textLine.LineMetrics.Size.Width) var lineWidth = textLine.Width + textLine.Start * 2;
if (width < lineWidth)
{ {
width = textLine.LineMetrics.Size.Width; width = lineWidth;
} }
height += textLine.LineMetrics.Size.Height; height += textLine.LineMetrics.Size.Height;

Loading…
Cancel
Save