Преглед изворни кода

Fixed Bug: BoundingBox ctor was missing in GraphicalNote.
Made MusicSheetCalculator abstract - fixed usage.

Matthias пре 9 година
родитељ
комит
80743f0fe9

+ 2 - 0
src/MusicalScore/Graphical/GraphicalNote.ts

@@ -7,12 +7,14 @@ import {Pitch} from "../../Common/DataObjects/pitch";
 import {GraphicalStaffEntry} from "./GraphicalStaffEntry";
 import {GraphicalObject} from "./GraphicalObject";
 import {MusicSheetCalculator} from "./MusicSheetCalculator";
+import {BoundingBox} from "./BoundingBox";
 
 export class GraphicalNote extends GraphicalObject {
     constructor(note: Note, parent: GraphicalStaffEntry) {
         super();
         this.sourceNote = note;
         this.parentStaffEntry = parent;
+        this.PositionAndShape = new BoundingBox(this, parent.PositionAndShape);
     }
 
     public sourceNote: Note;

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

@@ -53,7 +53,7 @@ import {Logging} from "../../Common/logging";
 import Dictionary from "typescript-collections/dist/lib/Dictionary";
 import {CollectionUtil} from "../../Util/collectionUtil";
 
-export class MusicSheetCalculator {
+export abstract class MusicSheetCalculator {
     public static transposeCalculator: ITransposeCalculator;
     protected static textMeasurer: ITextMeasurer;
     protected staffEntriesWithGraphicalTies: GraphicalStaffEntry[] = [];

+ 2 - 1
src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts

@@ -24,12 +24,13 @@ import {OrnamentContainer} from "../../VoiceData/OrnamentContainer";
 import {ArticulationEnum} from "../../VoiceData/VoiceEntry";
 import {Tuplet} from "../../VoiceData/Tuplet";
 import Dictionary from "typescript-collections/dist/lib/Dictionary";
+import {VexFlowTextMeasurer} from "./VexFlowTextMeasurer";
 //import {VexFlowMeasure} from "./VexFlowMeasure";
 
 export class VexFlowMusicSheetCalculator extends MusicSheetCalculator {
     constructor() {
         super(new VexFlowGraphicalSymbolFactory());
-
+        MusicSheetCalculator.TextMeasurer = new VexFlowTextMeasurer();
     }
 
     /**

+ 3 - 2
test/MusicalScore/Graphical/VexFlow/VexFlowMeasure.ts

@@ -5,6 +5,7 @@ import {GraphicalMusicSheet} from "../../../../src/MusicalScore/Graphical/Graphi
 import {IXmlElement} from "../../../../src/Common/FileIO/Xml";
 import {MusicSheet} from "../../../../src/MusicalScore/MusicSheet";
 import {MusicSheetReader} from "../../../../src/MusicalScore/ScoreIO/MusicSheetReader";
+import {VexFlowMusicSheetCalculator} from "../../../../src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator";
 
 
 describe("VexFlow Measure Test", () => {
@@ -37,8 +38,8 @@ describe("VexFlow Measure Test", () => {
     //});
 
     it("prepareGraphicalMusicSheet", (done: MochaDone) => {
-        let factory: IGraphicalSymbolFactory = new VexFlowGraphicalSymbolFactory();
-        let calc: MusicSheetCalculator = new MusicSheetCalculator(factory);
+        let calc: VexFlowMusicSheetCalculator = new VexFlowMusicSheetCalculator();
+        
         let path: string = "test/data/MuzioClementi_SonatinaOpus36No1_Part1.xml";
         let doc: Document = ((window as any).__xml__)[path];
         chai.expect(doc).to.not.be.undefined;