@stringsync/vexml
Version:
MusicXML to Vexflow
72 lines (71 loc) • 2.79 kB
TypeScript
import * as rendering from '../rendering';
import * as vexflow from 'vexflow';
import * as components from '../components';
import * as playback from '../playback';
import { Config } from '../config';
import { VexmlElement } from './types';
import { Rect } from '../spatial';
import { EventListener } from '../events';
import { Logger } from '../debug';
import { EventMap } from './types';
import { System } from './system';
import { Measure } from './measure';
/** Score is a rendered musical score. */
export declare class Score {
private config;
private log;
private document;
private ctx;
private root;
private scoreRender;
private systems;
private isEventsCreated;
private cursors;
private constructor();
static create(config: Config, log: Logger, document: rendering.Document, ctx: vexflow.RenderContext, root: components.Root, scoreRender: rendering.ScoreRender): Score;
/** The name of the element, which can be used as a type discriminant. */
readonly name = "score";
/** Returns the bounding box of the element. */
rect(): Rect;
/** Returns the element that houses the VexFlow score. */
getVexflowElement(): SVGElement | HTMLCanvasElement;
/** Returns the element used as an overlay. */
getOverlayElement(): HTMLDivElement;
/** Returns the element used for the scroll container. */
getScrollContainer(): HTMLDivElement;
addCursor(opts?: {
partIndex?: number;
span?: playback.CursorVerticalSpan;
}): playback.Cursor;
/** Returns the title of the score. */
getTitle(): string | null;
/** Returns the systems of the score. */
getSystems(): System[];
/** Returns the measures of the score. */
getMeasures(): Measure[];
/** Returns the duration of the score in milliseconds. */
getDurationMs(): number;
/** Returns the max number of parts in this score. */
getPartCount(): number;
/** Removes the score from the DOM. */
destroy(): void;
/** Dispatches a native event to the overlay. */
dispatchNativeEvent(event: Event): void;
/** Adds an event listener to the score. */
addEventListener<N extends keyof EventMap>(type: N, listener: EventListener<EventMap[N]>): number;
/** Removes an event listener from the score. */
removeEventListener(...ids: number[]): void;
/**
* Returns all the elements at a given point.
*
* Functions similar to document.elementsFromPoint.
* See https://developer.mozilla.org/en-US/docs/Web/API/Document/elementsFromPoint
*/
elementsFromPoint(x: number, y: number): VexmlElement[];
/** Renders the entire score. */
render(): void;
private events;
private getTimelines;
private getElementLocator;
private getTimestampLocator;
}