Skip to content

Commit

Permalink
Fix #28 Follow cursor in Verovio
Browse files Browse the repository at this point in the history
  • Loading branch information
infojunkie committed May 26, 2023
1 parent 1859dec commit 1d2c9b5
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 11 deletions.
17 changes: 13 additions & 4 deletions dist/musicxml-player.esm.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* musicxml-player v0.7.3
* musicxml-player v0.8.0
* (c) Karim Ratib <[email protected]> (https://github.com/infojunkie)
* Released under the GPL-3.0-only License.
*/
Expand Down Expand Up @@ -12582,7 +12582,7 @@ class WebAudioFontOutput {
}

var name = "musicxml-player";
var version = "0.7.3";
var version = "0.8.0";
var description = "A simple JavaScript component that loads and plays MusicXML files in the browser using Web Audio and Web MIDI.";
var main = "dist/musicxml-player.esm.js";
var type = "module";
Expand Down Expand Up @@ -15383,8 +15383,17 @@ class VerovioRenderer {
this._notes = notes;
this._notes.forEach((noteid) => {
const note = document.getElementById(noteid);
note === null || note === void 0 ? void 0 : note.setAttribute('fill', '#c00');
note === null || note === void 0 ? void 0 : note.setAttribute('stroke', '#c00');
if (!note)
return;
note.setAttribute('fill', '#c00');
note.setAttribute('stroke', '#c00');
if (this._options.breaks === 'none') {
note.scrollIntoView({ 'behavior': 'auto', 'inline': 'center' });
}
else {
const system = note.closest('.system');
system === null || system === void 0 ? void 0 : system.scrollIntoView({ 'behavior': 'auto', 'block': 'center' });
}
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion dist/musicxml-player.esm.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/types/VerovioRenderer.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "musicxml-player",
"version": "0.7.3",
"version": "0.8.0",
"description": "A simple JavaScript component that loads and plays MusicXML files in the browser using Web Audio and Web MIDI.",
"main": "dist/musicxml-player.esm.js",
"type": "module",
Expand Down
12 changes: 10 additions & 2 deletions src/VerovioRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,16 @@ export class VerovioRenderer implements ISheetRenderer {
this._notes = notes;
this._notes.forEach((noteid) => {
const note = document.getElementById(noteid);
note?.setAttribute('fill', '#c00');
note?.setAttribute('stroke', '#c00');
if (!note) return;
note.setAttribute('fill', '#c00');
note.setAttribute('stroke', '#c00');
if (this._options.breaks === 'none') {
note.scrollIntoView({ 'behavior': 'auto', 'inline': 'center' });
}
else {
const system = note.closest('.system');
system?.scrollIntoView({ 'behavior': 'auto', 'block': 'center' });
}
});
}
}
Expand Down

0 comments on commit 1d2c9b5

Please sign in to comment.