UNPKG

@stringsync/vexml

Version:

MusicXML to Vexflow

38 lines (37 loc) 1.25 kB
import { Measure } from './measure'; export class System { config; log; document; systemRender; measures; constructor(config, log, document, systemRender, measures) { this.config = config; this.log = log; this.document = document; this.systemRender = systemRender; this.measures = measures; } static create(config, log, document, systemRender) { const measures = systemRender.measureRenders.map((measureRender) => Measure.create(config, log, document, measureRender)); return new System(config, log, document, systemRender, measures); } /** The name of the element, which can be used as a type discriminant. */ name = 'system'; /** Returns the bounding box of the element. */ rect() { return this.systemRender.rect; } /** Returns the system index that this system resides in. */ getIndex() { return this.systemRender.key.systemIndex; } /** Returns the measures of the system. */ getMeasures() { return this.measures; } /** Returns the max number of parts in this score. */ getPartCount() { return Math.max(0, ...this.measures.map((measure) => measure.getPartCount())); } }