Skip to content

Commit

Permalink
repaints for chord and measure charts
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam McKee committed Oct 10, 2024
1 parent 2374c80 commit f9afbc8
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.0.9

* ChordChartDisplay and MeasureDisplay repaints when painter params update

## 0.0.8

* MeasureDisplay without notes skips NotePositioning and renders chart without any notes
Expand Down
8 changes: 7 additions & 1 deletion lib/display/chord_display.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,11 @@ class ChordChartPainter extends CustomPainter {
}

@override
bool shouldRepaint(CustomPainter oldDelegate) => false;
bool shouldRepaint(ChordChartPainter oldDelegate) =>
!identical(chord, oldDelegate.chord) ||
!identical(fretSpacing, oldDelegate.fretSpacing) ||
!identical(noteRadius, oldDelegate.noteRadius) ||
!identical(stringCount, oldDelegate.stringCount) ||
!identical(stringSpacing, oldDelegate.stringSpacing) ||
!identical(tabContext, oldDelegate.tabContext);
}
5 changes: 4 additions & 1 deletion lib/display/grid_painter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,8 @@ class GridPainter extends CustomPainter {
}

@override
bool shouldRepaint(CustomPainter oldDelegate) => false;
bool shouldRepaint(GridPainter oldDelegate) =>
!identical(horizontalLines, oldDelegate.horizontalLines) ||
!identical(tabContext, oldDelegate.tabContext) ||
!identical(verticalLines, oldDelegate.verticalLines);
}
14 changes: 12 additions & 2 deletions lib/display/measure_display.dart
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,12 @@ class MeasureChartPainter extends CustomPainter {
}

@override
bool shouldRepaint(CustomPainter oldDelegate) => false;
bool shouldRepaint(MeasureChartPainter oldDelegate) =>
!identical(chartPositioning, oldDelegate.chartPositioning) ||
!identical(instrument, oldDelegate.instrument) ||
!identical(last, oldDelegate.last) ||
!identical(measure, oldDelegate.measure) ||
!identical(tabContext, oldDelegate.tabContext);
}

extension RepeatCircleCenterFns on Instrument {
Expand Down Expand Up @@ -275,5 +280,10 @@ class MeasureNotePainter extends CustomPainter {
}

@override
bool shouldRepaint(CustomPainter oldDelegate) => false;
bool shouldRepaint(MeasureNotePainter oldDelegate) =>
!identical(chartPositioning, oldDelegate.chartPositioning) ||
!identical(measure, oldDelegate.measure) ||
!identical(noteLabelPaint, oldDelegate.noteLabelPaint) ||
!identical(notePositioning, oldDelegate.notePositioning) ||
!identical(tabContext, oldDelegate.tabContext);
}

0 comments on commit f9afbc8

Please sign in to comment.