piano-chart
Version:
Display notes on a piano keyboard
35 lines (34 loc) • 1.38 kB
TypeScript
import { G, Rect, Text, Circle } from '@svgdotjs/svg.js';
import { PianoElement, KeyEventHandler } from './PianoElement';
import { INoteValue, NoteValue } from './Note';
import { InstrumentSettings } from './InstrumentSettings';
export declare class Key extends PianoElement {
private _note;
get note(): NoteValue;
private _displayNote;
private get displayNote();
protected _visual?: Rect;
protected _label?: G;
protected _labelText?: Text;
protected _highlight?: Circle;
protected highlightSize: number;
protected width: number;
protected height: number;
protected isPressed: boolean;
protected get isHighlighted(): boolean;
protected get isSpecialHighlighted(): boolean;
constructor(container: G, instrumentSettings: InstrumentSettings, onKeyPress: KeyEventHandler, onKeyRelease: KeyEventHandler, width: number, height: number, note: NoteValue);
protected addMouseListeners(): void;
private isMouseDown;
private handleInputDown;
private handleInputUp;
press(displayNote: INoteValue): void;
release(): void;
backward(): void;
private accidentalToUnicode;
protected createLabel(color: string): void;
protected updateLabel(): void;
protected createHighlight(size: number): void;
protected layout(): void;
private getNoteIfHighlighted;
}