修复PieChart在设置Space参数后动画绘制异常的问题

This commit is contained in:
monitor1394
2020-04-16 08:36:56 +08:00
parent a7c158e9c3
commit 5f1c6f2fbd
2 changed files with 4 additions and 1 deletions

View File

@@ -646,6 +646,7 @@ namespace XCharts
spaceAngle = 2 * Mathf.Asin(space / (2 * radius));
realStartAngle = startAngle + spaceAngle;
realToAngle = toAngle - spaceAngle;
if (realToAngle < realStartAngle) realToAngle = realStartAngle;
p2 = GetPos(p, radius, realStartAngle);
}
if (needBorder)
@@ -659,6 +660,7 @@ namespace XCharts
p2 = borderX1;
realToAngle = realToAngle - borderAngle;
if (realToAngle < realStartAngle) realToAngle = realStartAngle;
var borderX2 = GetPos(p, radius, realToAngle);
var pEnd = GetPos(p, radius, toAngle - spaceAngle);
DrawPolygon(vh, realCenter, borderX2, pEnd, spaceCenter, borderColor);
@@ -768,7 +770,7 @@ namespace XCharts
var needBorder = borderWidth != 0;
var needSpace = space != 0;
var diffAngle = Mathf.Abs(toDegree - startDegree) * Mathf.Deg2Rad;
int segments = (int)((2 * Mathf.PI * outsideRadius) * (diffAngle * Mathf.Rad2Deg / 360) / smoothness);
float startAngle = startDegree * Mathf.Deg2Rad;
float toAngle = toDegree * Mathf.Deg2Rad;