Ver código fonte

fix(Octava display error): Fixed the octave shift bracket to be shown over the note line

#490
Benjamin Giesinger 6 anos atrás
pai
commit
0e7f9f7f4d

+ 9 - 3
src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetDrawer.ts

@@ -274,9 +274,15 @@ export class VexFlowMusicSheetDrawer extends MusicSheetDrawer {
                 const ctx: Vex.IRenderContext = this.backend.getContext();
                 const textBracket: Vex.Flow.TextBracket = (graphicalOctaveShift as VexFlowOctaveShift).getTextBracket();
                 textBracket.setContext(ctx);
-                const headroom: number = staffLine.SkyBottomLineCalculator
-                                                  .getSkyLineMinInRange(textBracket.start.getX() / 10, textBracket.stop.getX() / 10);
-                textBracket.start.getStave().options.space_above_staff_ln = Math.floor(headroom) - 2;
+                if ((<any>textBracket).position === Vex.Flow.TextBracket.Positions.TOP) {
+                    const headroom: number = staffLine.SkyBottomLineCalculator
+                                                      .getSkyLineMinInRange(textBracket.start.getAbsoluteX() / 10, textBracket.stop.getAbsoluteX() / 10);
+                    textBracket.start.getStave().options.space_above_staff_ln = headroom;
+                } else {
+                    const footroom: number = staffLine.SkyBottomLineCalculator
+                                                      .getBottomLineMaxInRange(textBracket.start.getAbsoluteX() / 10, textBracket.stop.getAbsoluteX() / 10);
+                    textBracket.start.getStave().options.space_below_staff_ln = footroom;
+                }
                 textBracket.draw();
             }
         }