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

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

View File

@@ -1,6 +1,7 @@
# 更新日志
* (2020.04.16) 修复`PieChart`在设置`Space`参数后动画绘制异常的问题
* (2020.04.11) 发布`v1.4.0`版本
* (2020.04.11) 增加`Check warning`检测功能
* (2020.04.09) 修复`Legend`初始化异常的问题

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;