Forráskód Böngészése

fix tabs throwing error because of setLedgerLineStyle (doesn't exist on TabNote)

sschmid 4 éve
szülő
commit
7423aa396c
1 módosított fájl, 14 hozzáadás és 10 törlés
  1. 14 10
      src/MusicalScore/Graphical/VexFlow/VexFlowVoiceEntry.ts

+ 14 - 10
src/MusicalScore/Graphical/VexFlow/VexFlowVoiceEntry.ts

@@ -7,6 +7,7 @@ import { GraphicalNote } from "..";
 import { NoteEnum } from "../../../Common/DataObjects/Pitch";
 import { Note } from "../../VoiceData/Note";
 import { ColoringModes } from "./../DrawingParameters";
+import { TabNote } from "../../VoiceData/TabNote";
 
 export class VexFlowVoiceEntry extends GraphicalVoiceEntry {
     private mVexFlowStaveNote: Vex.Flow.StemmableNote;
@@ -121,16 +122,19 @@ export class VexFlowVoiceEntry extends GraphicalVoiceEntry {
                     }
                 }
                 // set ledger line color. TODO coordinate this with VexFlowConverter.StaveNote(), where there's also still code for this, maybe unnecessarily.
-                if (noteheadColor === transparentColor) {
-                    (vfStaveNote as any).setLedgerLineStyle({ fillStyle: noteheadColor, strokeStyle: noteheadColor, lineWidth: this.rules.LedgerLineWidth });
-                } else {
-                    (vfStaveNote as any).setLedgerLineStyle({
-                        fillStyle: this.rules.LedgerLineColorDefault,
-                        lineWidth: this.rules.LedgerLineWidth,
-                        strokeStyle: this.rules.LedgerLineColorDefault
-                    });
-                    // we could give the color (style) as noteheadColor, but then we need to figure out which note has the ledger line.
-                    // otherwise ledger lines get the color of the top note, see Function Test Color.
+                if (!(note.sourceNote instanceof TabNote)) { // setLedgerLineStyle doesn't exist on TabNote, would throw error.
+                    if (noteheadColor === transparentColor && !(note instanceof TabNote)) {
+                        (vfStaveNote as any).setLedgerLineStyle(
+                            { fillStyle: noteheadColor, strokeStyle: noteheadColor, lineWidth: this.rules.LedgerLineWidth });
+                    } else {
+                        (vfStaveNote as any).setLedgerLineStyle({
+                            fillStyle: this.rules.LedgerLineColorDefault,
+                            lineWidth: this.rules.LedgerLineWidth,
+                            strokeStyle: this.rules.LedgerLineColorDefault
+                        });
+                        // we could give the color (style) as noteheadColor, but then we need to figure out which note has the ledger line.
+                        // otherwise ledger lines get the color of the top note, see Function Test Color.
+                    }
                 }
             }
         }