Annotation constructor

Annotation(
  1. ChantContext ctxt,
  2. String text, [
  3. int? elementIndex
])

Implementation

Annotation(ChantContext ctxt, String text, [this.elementIndex])
  : padding =
        ctxt.staffInterval *
        (ctxt.textStyles['annotation']?['padding'] as num? ?? 0).toDouble(),

    super(
      ctxt: ctxt,
      text: (ctxt.textStyles['annotation']?['prefix'] ?? '') + text,
      cssClass: 'annotation',
      fontFamily: (ctxt) => ctxt.textStyles['annotation']?['font'],
      fontSize: (ctxt) => ctxt.textStyles['annotation']?['size'],
      textAnchor: .center,
      sourceIndex: 0, // sourceIndex not provided in JS constructor
      sourceGabc: text,
    ) {
  textType = ctxt.theme.annotation;
  dominantBaseline = 'hanging';
}