Browse Source

Fix: fixed line endings width for repetitions

Matthias Uiberacker 7 years ago
parent
commit
1f69548ea2
1 changed files with 16 additions and 13 deletions
  1. 16 13
      src/MusicalScore/Graphical/VexFlow/VexFlowMeasure.ts

+ 16 - 13
src/MusicalScore/Graphical/VexFlow/VexFlowMeasure.ts

@@ -80,23 +80,26 @@ export class VexFlowMeasure extends StaffMeasure {
     }
 
     /**
-     * returns the x-width of a given measure line.
+     * returns the x-width (in units) of a given measure line {SystemLinesEnum}.
      * @param line
-     * @returns {SystemLinesEnum} the x-width
+     * @returns the x-width in osmd units
      */
     public getLineWidth(line: SystemLinesEnum): number {
-        // FIXME: See values in VexFlow's stavebarline.js
-        // ToDo: feature/Repetitions
-        // Extend the lineWidth calculation with all repetition lines.
-        // Change also the code in VexFlowConverter.line.
-        const vfline: any = VexFlowConverter.line(line);
-        switch (vfline) {
-            case Vex.Flow.StaveConnector.type.SINGLE:
-                return 1.0 / unitInPixels;
-            case Vex.Flow.StaveConnector.type.DOUBLE:
-                return 3.0 / unitInPixels;
+        // See values in VexFlow's stavebarline.js
+        switch (line) {
+            case SystemLinesEnum.SingleThin:
+                return 5.0 / unitInPixels;
+            case SystemLinesEnum.DoubleThin:
+                return 5.0 / unitInPixels;
+            case SystemLinesEnum.BoldThinDots:
+            case SystemLinesEnum.DotsThinBold:
+                return 20.0 / unitInPixels;
+            case SystemLinesEnum.DotsBoldBoldDots:
+                return 20.0 / unitInPixels;
+                case SystemLinesEnum.ThinBold:
+                return 5.0 / unitInPixels;
             default:
-                return 0;
+                return 5.0 / unitInPixels;
         }
     }