sschmidTU on develop
generateImages: replace console⦠(compare)
sschmidTU on develop
osmd.load: add optional tempTit⦠(compare)
sschmidTU on vexflow4
update to vexflow 4.0.3 (#1171) (compare)
@sschmidTU for example some variables
// protected zoomUpdated: boolean = false;
// protected needBackendUpdate: boolean = false;
// protected rules!: EngravingRules;
// protected sheet?: MusicSheet;
// protected graphic?: GraphicalMusicSheet;
// protected drawer!: VexFlowMusicSheetDrawer;
// protected drawingParameters!: DrawingParameters;
and the private function reset
I create a class which extends the OpenSheetMusicDisplay.ts
and need override some function and needs call these variable. It's wonderful if the lib change the private
to protected
for extend
(sheet as any).member
to access them.
I think I have seen a method with a promising name, but I ended up doing something like this:
let graphicalMeasure = osmdInstance.graphic.getGraphicalMeasureFromSourceMeasureAndIndex(
measure,
0
);
let rect = document.createElementNS(SVGNS, 'rect');
if (graphicalMeasure && graphicalMeasure.stave) {
['x', 'y', 'width', 'height'].forEach(prop => {
rect.setAttribute(prop, graphicalMeasure.stave[prop]);
}
svg.appendChild(rect);
and styling the rect appropriately.
public moveToGraphicalMeasure(graphicalMeasure?: GraphicalMeasure, forceShow?: boolean): this {
if (!graphicalMeasure) return this;
const musicSystem: MusicSystem = graphicalMeasure.ParentMusicSystem;
if (!musicSystem) return this;
const nextMusicSystem = musicSystem.NextSystem;
const bboxMusicSystem = musicSystem.PositionAndShape;
const bboxMeasure = graphicalMeasure.PositionAndShape;
const x = bboxMeasure.AbsolutePosition.x + bboxMeasure.BorderMarginLeft;
const width = bboxMeasure.Size.width;
const y = bboxMusicSystem.AbsolutePosition.y + bboxMusicSystem.BorderMarginTop;
let height = 0;
if (!nextMusicSystem) {
height = bboxMusicSystem.Size.height;
} else {
const bboxNextMusicSystem = nextMusicSystem.PositionAndShape;
height = bboxNextMusicSystem.AbsolutePosition.y + bboxNextMusicSystem.BorderMarginTop - y;
}
const offsetHaftHeight = 0.1;
const offsetHaftWidth = 0.2;
const tmpRect = new RectangleF2D(
x - offsetHaftWidth,
y - offsetHaftHeight,
width + offsetHaftWidth * 2,
height + offsetHaftHeight * 2
);
const rect = this.controller.applyScreenTransformationForRect(tmpRect);
this.currentGraphicalMeasure = graphicalMeasure;
// console.log(graphicalMeasure)
// console.log((graphicalMeasure as any).stave, x, y, width, height)
if (forceShow && this.hidden) {
return this.updateStyle(rect).show();
} {
return this.updateStyle(rect);
}
}