getInnerNodes<T> method

List<T> getInnerNodes<T>(
  1. ChantContext ctxt, {
  2. double top = 0,
  3. required NodeMaker<T> quickSvg,
  4. required ElementNodeMaker<T> element,
})

Implementation

List<T> getInnerNodes<T>(
  ChantContext ctxt, {
  double top = 0,
  required NodeMaker<T> quickSvg,
  required ElementNodeMaker<T> element,
}) {
  List<T> inner = [];

  final x1 = staffLeft;
  final x2 = staffRight;
  final staffSpaces = this.staffSpaces;
  if (ctxt.editable) {
    inner.add(
      quickSvg('rect', {
        'key': 'insertion',
        'x': x1,
        'y': ctxt.staffInterval * score.staffLineCount * -2 + 1,
        'width': x2 - x1,
        'height': ctxt.staffInterval * 2 * staffSpaces,
        'fill': 'none',
      }),
    );
  }

  for (int i = score.staffLineCount * -2 + 1; i < 0; i += 2) {
    inner.add(
      quickSvg('line', {
        'key': i,
        'x1': x1,
        'y1': ctxt.staffInterval * i,
        'x2': x2,
        'y2': ctxt.staffInterval * i,
        'stroke': ctxt.theme.staffLineColor.toSvgString(),
        'stroke-width': ctxt.staffLineWeight,
        'class': 'staffLine',
      }),
    );
  }

  inner = [
    quickSvg('g', {'class': 'staffLines'}, inner),
  ];

  if (layoutInsertionCursor(ctxt) != null) {
    inner.add(element(layoutInsertionCursor(ctxt)!, ctxt));
  }

  if (layoutInsertionPreview(ctxt) != null) {
    inner.add(element(layoutInsertionPreview(ctxt)!, ctxt));
  }

  for (int i = 0; i < ledgerLines.length; i++) {
    final ledgerLine = ledgerLines[i];
    final y = ctxt.calculateHeightFromStaffPosition(ledgerLine.staffPosition);

    inner.add(
      quickSvg('line', {
        'x1': ledgerLine.x1,
        'y1': y,
        'x2': ledgerLine.x2,
        'y2': y,
        'stroke': ctxt.theme.staffLineColor.toSvgString(),
        'stroke-width': ctxt.staffLineWeight,
        'class': 'ledgerLine',
      }),
    );
  }

  for (int i = 0; i < braces.length; i++) {
    inner.add(element(braces[i], ctxt));
  }

  if (notationsStartIndex == 0) {
    if (score.dropCap != null) {
      inner.add(element(score.dropCap!, ctxt));
    }

    if (score.annotation != null &&
        (ctxt.mergeAnnotationWithTextLeft == null || score.dropCap != null)) {
      inner.add(element(score.annotation!, ctxt));
    }
  }

  inner.add(element(startingClef!, ctxt));

  final notations = score.notations;
  final lastIndex = notationsStartIndex + numNotationsOnLine;

  for (int i = notationsStartIndex; i < lastIndex; i++) {
    inner.add(element(notations[i], ctxt));
  }

  if (custos != null) {
    inner.add(element(custos!, ctxt));
  }
  return inner;
}