Andrea Condoluci 9 роки тому
батько
коміт
ad67c39fd2

+ 2 - 1
external/vexflow/vexflow.d.ts

@@ -49,7 +49,8 @@ declare namespace Vex {
       public end_x: number;
 
       public setX(x: number): Stave;
-      public addClef(clef: Clef, size: any, annotation: any, position: any): void;
+      public addClef(clefSpec: string, size: any, annotation: any, position: any): void;
+      public setEndClef(clefSpec: string, size: any, annotation: any): void;
       public getYForGlyphs(): number;
       public getWidth(): number;
       public setWidth(width: number): Stave;

+ 2 - 2
src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts

@@ -80,7 +80,7 @@ export class VexFlowConverter {
         return vfnote;
     }
 
-    public static Clef(clef: ClefInstruction): Vex.Flow.Clef {
+    public static Clef(clef: ClefInstruction): string {
         let type: string;
         switch (clef.ClefType) {
             case ClefEnum.G:
@@ -100,7 +100,7 @@ export class VexFlowConverter {
                 break;
             default:
         }
-        return new Vex.Flow.Clef(type);
+        return type;
     }
 
     public static TimeSignature(rhythm: RhythmInstruction): Vex.Flow.TimeSignature {

+ 22 - 22
src/MusicalScore/Graphical/VexFlow/VexFlowMeasure.ts

@@ -67,9 +67,9 @@ export class VexFlowMeasure extends StaffMeasure {
      * @param clef
      */
     public addClefAtBegin(clef: ClefInstruction): void {
-        let vfclef: Vex.Flow.Clef = VexFlowConverter.Clef(clef);
+        let vfclef: string = VexFlowConverter.Clef(clef);
         this.stave.addClef(vfclef, undefined, undefined, Vex.Flow.Modifier.Position.BEGIN);
-        this.increaseBeginInstructionWidth(vfclef);
+        //this.increaseBeginInstructionWidth(vfclef);
     }
 
     /**
@@ -98,7 +98,7 @@ export class VexFlowMeasure extends StaffMeasure {
             timeSig,
             Vex.Flow.Modifier.Position.BEGIN
         );
-        this.increaseBeginInstructionWidth(timeSig);
+        //this.increaseBeginInstructionWidth(timeSig);
     }
 
     /**
@@ -107,9 +107,9 @@ export class VexFlowMeasure extends StaffMeasure {
      * @param clef
      */
     public addClefAtEnd(clef: ClefInstruction): void {
-        let vfclef: Vex.Flow.Clef = VexFlowConverter.Clef(clef);
-        this.stave.addClef(vfclef, undefined, undefined, Vex.Flow.Modifier.Position.END);
-        this.increaseEndInstructionWidth(vfclef);
+        let vfclef: string = VexFlowConverter.Clef(clef);
+        this.stave.setEndClef(vfclef, undefined, undefined);
+        //this.increaseEndInstructionWidth(vfclef);
     }
 
     /**
@@ -170,20 +170,20 @@ export class VexFlowMeasure extends StaffMeasure {
         // TODO
     }
 
-    private increaseBeginInstructionWidth(modifier: any): void {
-        let padding: number = modifier.getCategory("") === "keysignatures" ? modifier.getPadding(2) : 0;
-        //modifier.getPadding(this.begModifiers);
-        let width: number = modifier.getWidth();
-        this.beginInstructionsWidth += padding + width;
-
-        //if (padding + width > 0) {
-        //    this.begModifiers += 1;
-        //}
-    }
-
-    private increaseEndInstructionWidth(modifier: any): void {
-        let padding: number = 0; //modifier.getPadding(this.endModifiers++);
-        let width: number = modifier.getWidth();
-        this.endInstructionsWidth += padding + width;
-    }
+    //private increaseBeginInstructionWidth(modifier: StaveModifier): void {
+    //    let padding: number = modifier.getCategory("") === "keysignatures" ? modifier.getPadding(2) : 0;
+    //    //modifier.getPadding(this.begModifiers);
+    //    let width: number = modifier.getWidth();
+    //    this.beginInstructionsWidth += padding + width;
+    //
+    //    //if (padding + width > 0) {
+    //    //    this.begModifiers += 1;
+    //    //}
+    //}
+    //
+    //private increaseEndInstructionWidth(modifier: StaveModifier): void {
+    //    let padding: number = 0; //modifier.getPadding(this.endModifiers++);
+    //    let width: number = modifier.getWidth();
+    //    this.endInstructionsWidth += padding + width;
+    //}
 }