소스 검색

added refactors not caught by cherry-pick
#56

sschmidTU 7 년 전
부모
커밋
a0e43076ad

+ 5 - 5
src/MusicalScore/Graphical/AccidentalCalculator.ts

@@ -34,7 +34,7 @@ export class AccidentalCalculator {
         }
     }
 
-    public checkAccidental(graphicalNote: GraphicalNote, pitch: Pitch, grace: boolean, graceScalingFactor: number): void {
+    public checkAccidental(graphicalNote: GraphicalNote, pitch: Pitch): void {
         if (pitch === undefined) {
             return;
         }
@@ -48,7 +48,7 @@ export class AccidentalCalculator {
                 this.currentAlterationsComparedToKeyInstructionList.push(pitchKey);
             }
             this.currentInMeasureNoteAlterationsDict.setValue(pitchKey, pitch.Accidental);
-            this.symbolFactory.addGraphicalAccidental(graphicalNote, pitch, grace, graceScalingFactor);
+            this.symbolFactory.addGraphicalAccidental(graphicalNote, pitch);
         } else if (
             this.currentAlterationsComparedToKeyInstructionList.indexOf(pitchKey) !== -1
             && ((pitchKeyGivenInMeasureDict && this.currentInMeasureNoteAlterationsDict.getValue(pitchKey) !== pitch.Accidental)
@@ -72,7 +72,7 @@ export class AccidentalCalculator {
                 } else {
                     this.currentInMeasureNoteAlterationsDict.remove(pitchKey);
                 }
-                MusicSheetCalculator.symbolFactory.addGraphicalAccidental(graphicalNote, pitch, grace, graceScalingFactor);
+                MusicSheetCalculator.symbolFactory.addGraphicalAccidental(graphicalNote, pitch);
             }
         } else {
             if (pitch.Accidental !== AccidentalEnum.NONE) {
@@ -80,11 +80,11 @@ export class AccidentalCalculator {
                     this.currentAlterationsComparedToKeyInstructionList.push(pitchKey);
                 }
                 this.currentInMeasureNoteAlterationsDict.setValue(pitchKey, pitch.Accidental);
-                MusicSheetCalculator.symbolFactory.addGraphicalAccidental(graphicalNote, pitch, grace, graceScalingFactor);
+                MusicSheetCalculator.symbolFactory.addGraphicalAccidental(graphicalNote, pitch);
             } else {
                 if (isInCurrentAlterationsToKeyList) {
                     this.currentAlterationsComparedToKeyInstructionList.splice(this.currentAlterationsComparedToKeyInstructionList.indexOf(pitchKey), 1);
-                    MusicSheetCalculator.symbolFactory.addGraphicalAccidental(graphicalNote, pitch, grace, graceScalingFactor);
+                    MusicSheetCalculator.symbolFactory.addGraphicalAccidental(graphicalNote, pitch);
                 }
             }
         }

+ 1 - 5
src/MusicalScore/Graphical/MusicSheetCalculator.ts

@@ -1455,11 +1455,7 @@ export abstract class MusicSheetCalculator {
             );
         }
         graphicalNote.sourceNote.halfTone = pitch.getHalfTone();
-        let scalingFactor: number = 1.0;
-        if (grace) {
-            scalingFactor = this.rules.GraceNoteScalingFactor;
-        }
-        accidentalCalculator.checkAccidental(graphicalNote, pitch, grace, scalingFactor);
+        accidentalCalculator.checkAccidental(graphicalNote, pitch);
     }
 
     private updateSkyBottomLines(): void {

+ 1 - 3
src/MusicalScore/Graphical/VexFlow/VexFlowGraphicalSymbolFactory.ts

@@ -127,10 +127,8 @@ export class VexFlowGraphicalSymbolFactory implements IGraphicalSymbolFactory {
      * Will be only called if the displayed accidental is different from the original (e.g. a C# with C# as key instruction)
      * @param graphicalNote
      * @param pitch The pitch which will be rendered.
-     * @param grace
-     * @param graceScalingFactor
      */
-    public addGraphicalAccidental(graphicalNote: GraphicalNote, pitch: Pitch, grace: boolean, graceScalingFactor: number): void {
+    public addGraphicalAccidental(graphicalNote: GraphicalNote, pitch: Pitch): void {
         // ToDo: set accidental here from pitch.Accidental
         const note: VexFlowGraphicalNote = (graphicalNote as VexFlowGraphicalNote);
         note.setPitch(pitch);

+ 1 - 1
src/MusicalScore/Interfaces/IGraphicalSymbolFactory.ts

@@ -45,7 +45,7 @@ export interface IGraphicalSymbolFactory {
         activeClef: ClefInstruction,
         octaveShift: OctaveEnum): GraphicalNote;
 
-    addGraphicalAccidental(graphicalNote: GraphicalNote, pitch: Pitch, grace: boolean, graceScalingFactor: number): void;
+    addGraphicalAccidental(graphicalNote: GraphicalNote, pitch: Pitch): void;
 
     addFermataAtTiedEndNote(tiedNote: Note, graphicalStaffEntry: GraphicalStaffEntry): void;