From 97a81b781697f6e7166e9b7a9bba36fd972920f0 Mon Sep 17 00:00:00 2001 From: monitor1394 Date: Thu, 16 Apr 2020 08:36:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D`PieChart`=E5=9C=A8=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE`Space`=E5=8F=82=E6=95=B0=E5=90=8E=E5=8A=A8=E7=94=BB?= =?UTF-8?q?=E7=BB=98=E5=88=B6=E5=BC=82=E5=B8=B8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/XCharts/CHANGELOG.md | 1 + Assets/XCharts/Runtime/Utility/ChartDrawer.cs | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Assets/XCharts/CHANGELOG.md b/Assets/XCharts/CHANGELOG.md index d13c6bb6..30b17420 100644 --- a/Assets/XCharts/CHANGELOG.md +++ b/Assets/XCharts/CHANGELOG.md @@ -1,6 +1,7 @@ # 更新日志 +* (2020.04.16) 修复`PieChart`在设置`Space`参数后动画绘制异常的问题 * (2020.04.11) 发布`v1.4.0`版本 * (2020.04.11) 增加`Check warning`检测功能 * (2020.04.09) 修复`Legend`初始化异常的问题 diff --git a/Assets/XCharts/Runtime/Utility/ChartDrawer.cs b/Assets/XCharts/Runtime/Utility/ChartDrawer.cs index d6d0a4ac..41d15bf2 100644 --- a/Assets/XCharts/Runtime/Utility/ChartDrawer.cs +++ b/Assets/XCharts/Runtime/Utility/ChartDrawer.cs @@ -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;