Update PdfPath.cs

Need to account the case where a `Close` command is called but the first and last commands are not connected.
This commit is contained in:
BobLd
2019-10-06 12:47:12 +01:00
committed by GitHub
parent 1975db4752
commit 1c3519fd51

View File

@@ -200,6 +200,14 @@ namespace UglyToad.PdfPig.Geometry
internal void ClosePath()
{
if (currentPosition.HasValue)
{
var startPoint = GetStartPoint(commands.First());
if (!startPoint.Equals(currentPosition.Value))
{
shoeLaceSum += (double)((startPoint.X - currentPosition.Value.X) * (startPoint.Y + currentPosition.Value.Y));
}
}
commands.Add(new Close());
}