|
@@ -109,7 +109,7 @@ export class MeasureSizeCalculator {
|
|
);
|
|
);
|
|
for (let clef of clefs) {
|
|
for (let clef of clefs) {
|
|
voicesBoundingBox = voicesBoundingBox.mergeWith(
|
|
voicesBoundingBox = voicesBoundingBox.mergeWith(
|
|
- this.getClefBoundingBox(clef)
|
|
|
|
|
|
+ MeasureSizeCalculator.getClefBoundingBox(clef)
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -123,30 +123,32 @@ export class MeasureSizeCalculator {
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
- private getClefBoundingBox(clef: Vex.Flow.Clef): Vex.Flow.BoundingBox {
|
|
|
|
|
|
+ public static getClefBoundingBox(clef: Vex.Flow.Clef): Vex.Flow.BoundingBox {
|
|
|
|
+ let clef2: any = clef;
|
|
|
|
+ clef2.placeGlyphOnLine(clef2.glyph, clef2.stave, clef2.clef.line);
|
|
let glyph: any = clef.glyph;
|
|
let glyph: any = clef.glyph;
|
|
let x_pos: number = clef.x + glyph.x_shift;
|
|
let x_pos: number = clef.x + glyph.x_shift;
|
|
let y_pos: number = clef.stave.getYForGlyphs() + glyph.y_shift;
|
|
let y_pos: number = clef.stave.getYForGlyphs() + glyph.y_shift;
|
|
let scale: number = glyph.scale;
|
|
let scale: number = glyph.scale;
|
|
let outline: any[] = glyph.metrics.outline;
|
|
let outline: any[] = glyph.metrics.outline;
|
|
- let xmin: number = 0, xmax: number = 0,
|
|
|
|
- ymin: number = 0, ymax: number = 0;
|
|
|
|
|
|
+ let xmin: number = 0, xmax: number = 0, ymin: number = 0, ymax: number = 0;
|
|
|
|
|
|
function update(i: number): void {
|
|
function update(i: number): void {
|
|
- let x: number = outline[i];
|
|
|
|
- let y: number = outline[i];
|
|
|
|
|
|
+ let x: number = outline[i + 1];
|
|
|
|
+ let y: number = outline[i + 2];
|
|
xmin = Math.min(xmin, x);
|
|
xmin = Math.min(xmin, x);
|
|
xmax = Math.max(xmax, x);
|
|
xmax = Math.max(xmax, x);
|
|
ymin = Math.min(ymin, y);
|
|
ymin = Math.min(ymin, y);
|
|
ymax = Math.max(ymax, y);
|
|
ymax = Math.max(ymax, y);
|
|
}
|
|
}
|
|
|
|
|
|
- for (let i of outline) {
|
|
|
|
|
|
+ for (let i = 0, len = outline.length; i < len; i += 3) {
|
|
|
|
+ console.log(i, outline[i]);
|
|
switch (<string> outline[i]) {
|
|
switch (<string> outline[i]) {
|
|
case "m": update(i); break;
|
|
case "m": update(i); break;
|
|
case "l": update(i); break;
|
|
case "l": update(i); break;
|
|
- case "q": i++; update(i); break;
|
|
|
|
- case "b": i++; i++; update(i); break;
|
|
|
|
|
|
+ case "q": i += 2; update(i); break;
|
|
|
|
+ case "b": i += 4; update(i); break;
|
|
default: break;
|
|
default: break;
|
|
}
|
|
}
|
|
|
|
|