withPorrectusSwash method
void
withPorrectusSwash(
{ - required Note start,
- required Note end,
})
Implementation
void withPorrectusSwash({required Note start, required Note end}) {
final needsLine =
lastNote != null &&
(lineIsHanging ||
(lastNote!.glyphVisualizer != null &&
lastNote!.glyphVisualizer!.align == 'right') ||
(lastNote!.staffPosition - start.staffPosition).abs() > 1);
if (needsLine) {
final line = NeumeLineVisualizer(ctxt, lastNote!, start, lineIsHanging);
x = (minX > x - line.bounds.width) ? minX : x - line.bounds.width;
line.bounds = line.bounds.copyWith(x: x);
neume.addVisualizer(line);
}
GlyphCode glyph;
final diff = start.staffPosition - end.staffPosition;
switch (diff.toInt()) {
case 1:
glyph = GlyphCode.porrectus1;
break;
case 2:
glyph = GlyphCode.porrectus2;
break;
case 3:
glyph = GlyphCode.porrectus3;
break;
case 4:
glyph = GlyphCode.porrectus4;
break;
default:
glyph = GlyphCode.none;
break;
}
start.setGlyph(ctxt, glyph);
start.bounds = start.bounds.copyWith(x: x);
end.setGlyph(ctxt, GlyphCode.none);
x = start.bounds.right;
end.bounds = end.bounds.copyWith(
x: x - end.bounds.width - start.bounds.width / 2,
width: start.bounds.width / 2,
height: start.bounds.height / 2,
);
neume.addVisualizer(start);
neume.addVisualizer(end);
lastNote = end;
lineIsHanging = false;
}