Browse Source

fix skia formatted text unit tests.

pull/3213/head
Dan Walmsley 7 years ago
parent
commit
eb1241eea3
  1. 6
      src/Skia/Avalonia.Skia/FormattedTextImpl.cs

6
src/Skia/Avalonia.Skia/FormattedTextImpl.cs

@ -102,14 +102,18 @@ namespace Avalonia.Skia
AvaloniaFormattedTextLine line = default; AvaloniaFormattedTextLine line = default;
float nextTop = 0;
foreach(var currentLine in _skiaLines) foreach(var currentLine in _skiaLines)
{ {
if(currentLine.Top <= y) if(currentLine.Top <= y)
{ {
line = currentLine; line = currentLine;
nextTop = currentLine.Top + currentLine.Height;
} }
else else
{ {
nextTop = currentLine.Top;
break; break;
} }
} }
@ -140,7 +144,7 @@ namespace Avalonia.Skia
line.Length : (line.Length - 1); line.Length : (line.Length - 1);
} }
if (y < line.Top + line.Height) if (y < nextTop)
{ {
return new TextHitTestResult return new TextHitTestResult
{ {

Loading…
Cancel
Save