note.PrintObject = false
and call render()
again
osmd.cursor.GNotesUnderCursor()[0].getSVGGElement().getBBox()
to get a bbox around the full note (including stems), but I only want the notehead. I found there is a notehead().boundingBox
but looks like it is null. For context, I'm trying to dynamically draw a line through a notehead using Drawer.DrawOverlayLine
just in case there is a easier way to achieve this.
@sschmidTU I'm rendering a MusicXML in a single-line only (I collaborated with you on GH to remove the SVG max width limitation) ..
I've been searching through the docs and past issues, but I can't find a way to set a minimum measure width anywhere.. is that possible? For example when a measure has a single rest or whole note, I'd like to set some fixed minimum width so it's not rendered so small
GraphicalMeasure.setWidth
(prototype fn) and MusicSheetCalculator.setMeasuresMinStaffEntriesWidth
(static fn) to set the values to Max([existing value], MIN_WIDTH)
:const hackOSMDMinWidth = () => {
const MIN_MEASURE_WIDTH = 20;
GraphicalMeasure.prototype.setWidth = function (w: number) {
this.PositionAndShape.BorderRight = Math.max(w, MIN_MEASURE_WIDTH);
};
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(MusicSheetCalculator as any).setMeasuresMinStaffEntriesWidth = function (measures: GraphicalMeasure[], minimumStaffEntriesWidth: number): void {
for (let idx = 0, len = measures.length; idx < len; ++idx) {
const measure: GraphicalMeasure = measures[idx];
if (measure) {
// measure.minimumStaffEntriesWidth = minimumStaffEntriesWidth;
measure.minimumStaffEntriesWidth = Math.max(minimumStaffEntriesWidth, MIN_MEASURE_WIDTH);
}
}
};
};
for(let i = 0; i < 38; i++){
if(this.osmd.Sheet.SourceMeasures[i].StaffLinkedExpressions[0][0] && this.osmd.Sheet.SourceMeasures[i].StaffLinkedExpressions[0][0].InstantaneousDynamic){
console.log("DynEnum",this.osmd.Sheet.SourceMeasures[i].StaffLinkedExpressions[0][0].InstantaneousDynamic.DynEnum);
console.log("i:" + i);
}
}