From e3bd3cc5a985441496108e96559e799ccdbc7987 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Marle=CC=81?= Date: Tue, 18 Jun 2019 14:08:39 -0400 Subject: [PATCH] Fix for doughnut drawing --- src/Pie.js | 8 ++++---- src/Wedge.js | 13 +++++++------ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/Pie.js b/src/Pie.js index 9234d61..d06100c 100644 --- a/src/Pie.js +++ b/src/Pie.js @@ -11,11 +11,11 @@ class Pie extends Component { handleCover(){ if (!this.props.doughnut) return; const radius = this.getRadius(); - const coverRadius = this.props.chart_wh * this.props.coverRadius; + const coverRadius = this.props.chart_wh * this.props.coverRadius / 2; const coverPath = new Path() - .moveTo(radius, radius - (coverRadius / 2)) - .arc(0, coverRadius, 25) - .arc(0, -coverRadius, 25) + .moveTo(radius , radius - (coverRadius)) + .arc(0, coverRadius * 2, coverRadius) + .arc(0, -coverRadius * 2, coverRadius) .close(); return ; } diff --git a/src/Wedge.js b/src/Wedge.js index 29c5593..7bfbf14 100644 --- a/src/Wedge.js +++ b/src/Wedge.js @@ -169,14 +169,15 @@ class Wedge extends Component { const ir = Math.min(innerRadius, outerRadius); const or = Math.max(innerRadius, outerRadius); - let path; - if (endAngle >= startAngle + 360) { - path = this._createCirclePath(or, ir); - } else { - path = this._createArcPath(startAngle, endAngle, or, ir); - } + if (Platform.OS === 'ios' || (startAngle === 0 && endAngle == 360)) { + let path; + if (endAngle >= startAngle + 360) { + path = this._createCirclePath(or, ir); + } else { + path = this._createArcPath(startAngle, endAngle, or, ir); + } return ; } else { let size = this.props.outerRadius * 2;