Skip to content

Commit

Permalink
Fixed a bug where the mod-360 bypass draws a full-circle for 0 slices.
Browse files Browse the repository at this point in the history
  • Loading branch information
danielgindi committed Nov 16, 2016
1 parent 4cb83a7 commit 2e80fad
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ protected void drawDataSet(Canvas c, IPieDataSet dataSet) {
float arcStartPointX = center.x + radius * (float) Math.cos(startAngleOuter * Utils.FDEG2RAD);
float arcStartPointY = center.y + radius * (float) Math.sin(startAngleOuter * Utils.FDEG2RAD);

if (sweepAngleOuter % 360f <= Utils.FLOAT_EPSILON) {
if (sweepAngleOuter >= 360.f && sweepAngleOuter % 360f <= Utils.FLOAT_EPSILON) {
// Android is doing "mod 360"
mPathBuffer.addCircle(center.x, center.y, radius, Path.Direction.CW);
} else {
Expand Down Expand Up @@ -318,7 +318,7 @@ protected void drawDataSet(Canvas c, IPieDataSet dataSet) {
}
final float endAngleInner = startAngleInner + sweepAngleInner;

if (sweepAngleOuter % 360f == 0.f) {
if (sweepAngleOuter >= 360.f && sweepAngleOuter % 360f <= Utils.FLOAT_EPSILON) {
// Android is doing "mod 360"
mPathBuffer.addCircle(center.x, center.y, innerRadius, Path.Direction.CCW);
} else {
Expand All @@ -335,7 +335,7 @@ protected void drawDataSet(Canvas c, IPieDataSet dataSet) {
}
} else {

if (sweepAngleOuter % 360f != 0.f) {
if (sweepAngleOuter % 360f > Utils.FLOAT_EPSILON) {
if (accountForSliceSpacing) {

float angleMiddle = startAngleOuter + sweepAngleOuter / 2.f;
Expand Down Expand Up @@ -818,7 +818,7 @@ public void drawHighlighted(Canvas c, Highlight[] indices) {

mPathBuffer.reset();

if (sweepAngleOuter % 360f == 0.f) {
if (sweepAngleOuter >= 360.f && sweepAngleOuter % 360f <= Utils.FLOAT_EPSILON) {
// Android is doing "mod 360"
mPathBuffer.addCircle(center.x, center.y, highlightedRadius, Path.Direction.CW);
} else {
Expand Down Expand Up @@ -875,7 +875,7 @@ public void drawHighlighted(Canvas c, Highlight[] indices) {
}
final float endAngleInner = startAngleInner + sweepAngleInner;

if (sweepAngleOuter % 360f == 0.f) {
if (sweepAngleOuter >= 360.f && sweepAngleOuter % 360f <= Utils.FLOAT_EPSILON) {
// Android is doing "mod 360"
mPathBuffer.addCircle(center.x, center.y, innerRadius, Path.Direction.CCW);
} else {
Expand All @@ -892,7 +892,7 @@ public void drawHighlighted(Canvas c, Highlight[] indices) {
}
} else {

if (sweepAngleOuter % 360f != 0.f) {
if (sweepAngleOuter % 360f > Utils.FLOAT_EPSILON) {

if (accountForSliceSpacing) {
final float angleMiddle = startAngleOuter + sweepAngleOuter / 2.f;
Expand Down

0 comments on commit 2e80fad

Please sign in to comment.