Skip to content

Commit

Permalink
fixed pieChart touch bug, #146.
Browse files Browse the repository at this point in the history
  • Loading branch information
imaNNeo committed Jan 7, 2020
1 parent 18d9a69 commit 302f2f8
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/src/chart/pie_chart/pie_chart_painter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ class PieChartPainter extends BaseChartPainter<PieChartData> with TouchHandler<P
/// [centerSpacePaint] responsible to draw the center space of our chart.
Paint sectionPaint, sectionsSpaceClearPaint, centerSpacePaint;

/// We hold this calculated angles to use in touch handling,
List<double> sectionsAngle;

PieChartPainter(
PieChartData data,
PieChartData targetData,
Expand Down Expand Up @@ -46,7 +43,7 @@ class PieChartPainter extends BaseChartPainter<PieChartData> with TouchHandler<P
return;
}

sectionsAngle = _calculateSectionsAngle(data.sections, data.sumValue);
final List<double> sectionsAngle = _calculateSectionsAngle(data.sections, data.sumValue);

drawCenterSpace(canvas, size);
drawSections(canvas, size, sectionsAngle);
Expand Down Expand Up @@ -168,6 +165,7 @@ class PieChartPainter extends BaseChartPainter<PieChartData> with TouchHandler<P

@override
PieTouchResponse handleTouch(FlTouchInput touchInput, Size size) {
final List<double> sectionsAngle = _calculateSectionsAngle(data.sections, data.sumValue);
return _getTouchedDetails(size, touchInput, sectionsAngle);
}

Expand Down

0 comments on commit 302f2f8

Please sign in to comment.