Skip to content

Commit

Permalink
merge changes for verovio facsimile and file structure changes
Browse files Browse the repository at this point in the history
  • Loading branch information
yinanazhou committed Dec 18, 2024
1 parent 3f2113a commit 213d72f
Show file tree
Hide file tree
Showing 6 changed files with 533 additions and 330 deletions.
440 changes: 440 additions & 0 deletions Neon-gh/assets/js/verovio-toolkit-wasm.js

Large diffs are not rendered by default.

298 changes: 0 additions & 298 deletions Neon-gh/assets/js/verovio-toolkit.js

This file was deleted.

6 changes: 3 additions & 3 deletions Neon-gh/dashboard.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions Neon-gh/editor.js

Large diffs are not rendered by default.

69 changes: 69 additions & 0 deletions Neon-gh/workers/VerovioWorker-dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
importScripts('../assets/js/verovio-toolkit-wasm.js');

let toolkit;
const backlog = [];

/**
* Parse and respond to messages sent by NeonCore.
* @param {MessageEvent} evt
*/
function handleNeonEvent (evt) {
const data = evt.data;
const result = {
id: data.id
};

switch (data.action) {
case 'renderData':
result.svg = toolkit.renderData(data.mei, {});
break;
case 'getElementAttr':
result.attributes = toolkit.getElementAttr(data.elementId);
break;
case 'edit':
result.result = toolkit.edit(data.editorAction);
break;
case 'getMEI':
result.mei = toolkit.getMEI({
pageNo: 0,
scoreBased: true
});
break;
case 'editInfo':
result.info = toolkit.editInfo();
break;
case 'renderToSVG':
result.svg = toolkit.renderToSVG(1);
break;
default:
break;
}
postMessage(result);
}


verovio.module.onRuntimeInitialized = function () {

toolkit = new verovio.toolkit();
toolkit.setOptions({
inputFrom: 'mei',
footer: 'none',
header: 'none',
pageMarginLeft: 0,
pageMarginTop: 0,
font: 'Bravura',
useFacsimile: false,
});
console.debug('READY');
onmessage = handleNeonEvent;
for (const message of backlog) {
handleNeonEvent(message);
}
}


function tempHandler (evt) {
backlog.push(evt);
}

onmessage = tempHandler;
44 changes: 18 additions & 26 deletions Neon-gh/workers/VerovioWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,31 +39,23 @@ function handleNeonEvent (evt) {
postMessage(result);
}

var Module = {
onRuntimeInitialized: () => {
importScripts('https://www.verovio.org/javascript/develop/verovio-toolkit-wasm.js');

toolkit = new verovio.toolkit();
toolkit.setOptions({
inputFrom: 'mei',
footer: 'none',
header: 'none',
pageMarginLeft: 0,
pageMarginTop: 0,
font: 'Bravura',
useFacsimile: true,
});
console.debug('READY');
onmessage = handleNeonEvent;
for (const message of backlog) {
handleNeonEvent(message);
}
}
};

importScripts('../assets/js/verovio-toolkit.js');
verovio.module.onRuntimeInitialized = () => {

function tempHandler (evt) {
backlog.push(evt);
}

onmessage = tempHandler;
toolkit = new verovio.toolkit();
toolkit.setOptions( {
inputFrom: 'mei',
footer: 'none',
header: 'none',
pageMarginLeft: 0,
pageMarginTop: 0,
font: 'Bravura',
useFacsimile: false,
});
console.debug('READY');
onmessage = handleNeonEvent;
for (const message of backlog) {
handleNeonEvent(message);
}
};

0 comments on commit 213d72f

Please sign in to comment.