osmd.load()
without osmd.render()
, then the interpreted xml model is in osmd.sheet
.osmd.graphic.getClickedObject()
might help with this problem? If you calculate mouse coordinates relative to the SVG and pass an object with x and y to getClickedObject() you might get something to iterate to.. But I still don't know OSMD well enough, so maybe I'm barking up the wrong tree..
osmd.rules.DefaultColorCursor
in osmd 0.9.3
@phamconganh that is a weird MusicXML sample.
you can't easily remove these "words" expressions yet,
we can create an EngravingRule for that soon,
but you can try something like this after osmd.load()
:
removeUnknownExpressions() {
for (let i: number = 0; i < osmd.graphic.ParentMusicSheet.SourceMeasures.length; i++) {
const sourceMeasure: SourceMeasure = osmd.graphic.ParentMusicSheet.SourceMeasures[i];
for (let j: number = 0; j < sourceMeasure.StaffLinkedExpressions.length; j++) {
if (!this.graphicalMusicSheet.MeasureList[i] || !this.graphicalMusicSheet.MeasureList[i][j]) {
continue;
}
for (let k: number = 0; k < sourceMeasure.StaffLinkedExpressions[j].length; k++) {
sourceMeasure.StaffLinkedExpressions[j][k].unknownList = [];
}
}
}
}
but i haven't tested this. this is modified from MusicSheetCalculator.calculateMoodAndUnknownExpressions()
.
@rvilarl
In the sources there are some changes apply to vexflow (vexflowpatch). Would it make sense to include the sources of vexflow into osmd rather than vexflowpatch and decide what to update from vexflow or what to patch?
No, or I don't understand. Adding all vexflow classes that we don't patch is unnecessary, and would make it hard to see what we patched in vexflow.
In the sources there is only one reference to process.env: "public drawableBoundingBoxElement: string = process.env.DRAW_BOUNDING_BOX_ELEMENT;" would it make sense to replace that by an option in IOSMDOptions?
No, that is only used for continuous integration testing anyways, and i think it's currently mostly unused.
I made a prototype to support several cursors simustaneously with different colors and types. How would you suggest to approach the implementation of their configuration as additional parameters in the constructor of OpenSheetMusicDisplay(I did it this way): "constructor(container: string | HTMLElement, cursorColors: string[], cursorTypes: number[], options: IOSMDOptions = OSMDOptions.OSMDOptionsStandard())" or with additional IOSMDOptions?
It's great you made a prototype able to show multiple cursors!
However, i would avoid bloating the constructor, and i would simply add methods to add cursors. Maybe even locate these methods in the cursor class instead of OpenSheetMusicDisplay. Alternatively, cursorColors
and cursorTypes
could easily be integrated into IOSMDOptions.
process.env
usage, but since it isn't used for anything right now, it seems unimportant.
process.env.STATIC_FILES_SUBFOLDER
as well.