Parcourir la source

Fix To Coda and D.S. al Coda positioning (#920)

sschmid il y a 4 ans
Parent
commit
f8a44e42e4
1 fichiers modifiés avec 6 ajouts et 1 suppressions
  1. 6 1
      src/VexFlowPatch/src/staverepetition.js

+ 6 - 1
src/VexFlowPatch/src/staverepetition.js

@@ -119,7 +119,12 @@ export class Repetition extends StaveModifier {
       text_x = this.x + stave.options.vertical_bar_width;
       symbol_x = text_x + ctx.measureText(text).width + 12;
     } else if (this.symbol_type === Repetition.type.TO_CODA) {
-      text_x = this.x + stave.options.vertical_bar_width;
+      text_x = x + this.x + stave.options.vertical_bar_width;
+      symbol_x = text_x + ctx.measureText(text).width + 12;
+    } else if (this.symbol_type === Repetition.type.DS_AL_CODA) {
+      this.x_shift = -(text_x + ctx.measureText(text).width + 12 + stave.options.vertical_bar_width + 12);
+      // DS_AL_CODA draws in the next measure without this x_shift, not sure why for this symbol specifically.
+      text_x = this.x + this.x_shift + stave.options.vertical_bar_width;
       symbol_x = text_x + ctx.measureText(text).width + 12;
     } else {
       // Offset Signo text to left stave end