UNPKG

@stringsync/vexml

Version:

MusicXML to Vexflow

37 lines (36 loc) 1.15 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SimpleCursor = void 0; const STRINGSYNC_RED = 'rgba(252, 53, 76, 0.8)'; class SimpleCursor { element; constructor(element) { this.element = element; } static render(parent, color = STRINGSYNC_RED) { const element = document.createElement('div'); element.classList.add('vexml-cursor'); element.style.display = 'block'; element.style.position = 'absolute'; element.style.backgroundColor = color; parent.insertBefore(element, parent.firstChild); return new SimpleCursor(element); } /** Moves the cursor's position to the given rect. */ update(opts) { this.element.style.left = `${opts.x}px`; this.element.style.top = `${opts.y}px`; this.element.style.width = `${opts.w}px`; this.element.style.height = `${opts.h}px`; } remove() { this.element.remove(); } show() { this.element.style.display = 'block'; } hide() { this.element.style.display = 'none'; } } exports.SimpleCursor = SimpleCursor;