UNPKG

@stringsync/vexml

Version:

MusicXML to Vexflow

55 lines (54 loc) 2.08 kB
import { Logger } from '../debug'; import { Config } from '../config'; import { Document } from './document'; import { FragmentKey, FragmentRender } from './types'; export type EnsembleFormatParams = { x: number; width: number | null; paddingLeft: number; paddingRight: number; cache: FragmentRender | null; }; export declare class Ensemble { private config; private log; private document; private key; constructor(config: Config, log: Logger, document: Document, key: FragmentKey); /** Formats the ensemble, updating the rects and vexflow objects in place. */ format(fragmentRender: FragmentRender, { x, width, paddingLeft, paddingRight, cache }: EnsembleFormatParams): void; private draw; private hydrate; /** Returns extra width to accommodate curves */ private getCurveExtraWidth; private getTupletExtraWidth; private getStartClefWidth; private getEndClefWidth; private getTimeWidth; private getKeyWidth; private getVoiceWidth; private getMultiRestStaveWidth; private getMinRequiredStaveWidth; private getMinRequiredVoiceWidth; /** * Returns the rect of the stave itself, ignoring any influence by child elements such as notes. */ private calculateStaveIntrinsicRect; private calculateStavePlayableRect; private overrideVexflowStaveRect; /** The vexflow text dynamics bounding box is incorrect. This method returns a reasonable approximation. */ private overrideVexflowTextDynamicsRect; private overrideVexflowTabNoteRect; /** * Returns how much height the voice exceeded the normal vexflow.Stave (not EnsembleStave) boundaries. Callers may * need to account for this when positioning the system that this ensemble belongs to. */ private getExcessHeight; /** * A temporary hack to fix vexflow.GraceNoteGroup bounding boxes post-formatting. * * See https://github.com/vexflow/vexflow/issues/253 */ private maybefixVexflowGraceNoteGroupBoundingBox; private hackEntryRenderRect; }