Skip to content

Commit

Permalink
scale chord chart finger position shadows with radius
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam McKee committed May 4, 2024
1 parent 2a246ac commit a588a8c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/display/chord_display.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,15 @@ class ChordChartPainter extends CustomPainter {
}

void drawNote(Canvas canvas, Size size, Note note) {
const double minShadowElevation = 2;
const double maxShadowElevation = 5;
final x = size.width - (note.string - 1) * stringSpacing;
final y = ((note.fret - 1) * fretSpacing) + (fretSpacing / 2);
final path = Path()
..addOval(Rect.fromCircle(center: Offset(x, y), radius: noteRadius));
canvas.drawShadow(path, tabContext.noteLabelColor, 6, false);
final shadowElevation =
(noteRadius / 2).clamp(minShadowElevation, maxShadowElevation);
canvas.drawShadow(path, tabContext.noteLabelColor, shadowElevation, false);
canvas.drawPath(path, tabContext.noteShapePaint);

if (note.and != null) {
Expand Down

0 comments on commit a588a8c

Please sign in to comment.