positionInclinataMorae method

void positionInclinataMorae(
  1. List<Note> notes
)

Implementation

void positionInclinataMorae(List<Note> notes) {
  var subset = notes.length >= 2 ? notes.sublist(notes.length - 2) : notes;
  if (subset.length < 2 ||
      subset[1].staffPosition > subset[0].staffPosition) {
    return;
  }
  var bottomNote = subset[1];
  var topNote = subset[0];

  // The mora on the second (lower) note should be below the punctum,
  // if the punctum is on a line and the previous punctum is in the space above.
  if ((bottomNote.staffPosition.abs() % 2) == 1 &&
      topNote.staffPosition - bottomNote.staffPosition == 1 &&
      bottomNote.morae.isNotEmpty) {
    var mark = bottomNote.morae.last;
    if (mark.positionHint == MarkingPositionHint.defaultHint) {
      mark.positionHint = MarkingPositionHint.below;
    }
  }
}