فهرست منبع

Adapted code for brace and bracket generation for use with vexflow.

Matthias 8 سال پیش
والد
کامیت
fd40c22d81
2فایلهای تغییر یافته به همراه8 افزوده شده و 24 حذف شده
  1. 5 21
      src/MusicalScore/Graphical/MusicSystem.ts
  2. 3 3
      src/MusicalScore/Graphical/VexFlow/VexFlowMusicSystem.ts

+ 5 - 21
src/MusicalScore/Graphical/MusicSystem.ts

@@ -220,15 +220,7 @@ export abstract class MusicSystem extends GraphicalObject {
                     }
                 }
                 if (firstStaffLine !== undefined && lastStaffLine !== undefined) {
-                    let rightUpper: PointF2D = new PointF2D(
-                        firstStaffLine.PositionAndShape.RelativePosition.x,
-                        firstStaffLine.PositionAndShape.RelativePosition.y
-                    );
-                    let rightLower: PointF2D = new PointF2D(
-                        lastStaffLine.PositionAndShape.RelativePosition.x,
-                        lastStaffLine.PositionAndShape.RelativePosition.y + staffHeight
-                    );
-                    this.createInstrumentBracket(rightUpper, rightLower);
+                    this.createInstrumentBracket(firstStaffLine, lastStaffLine);
                 }
             }
         }
@@ -261,16 +253,8 @@ export abstract class MusicSystem extends GraphicalObject {
                     lastStaffLine = staffLine;
                 }
             }
-            if (firstStaffLine !== undefined && lastStaffLine !== undefined) {
-                let rightUpper: PointF2D = new PointF2D(
-                    firstStaffLine.PositionAndShape.RelativePosition.x,
-                    firstStaffLine.PositionAndShape.RelativePosition.y
-                );
-                let rightLower: PointF2D = new PointF2D(
-                    lastStaffLine.PositionAndShape.RelativePosition.x,
-                    lastStaffLine.PositionAndShape.RelativePosition.y + staffHeight
-                );
-                this.createGroupBracket(rightUpper, rightLower, staffHeight, recursionDepth);
+            if (firstStaffLine !== undefined && firstStaffLine !== undefined) {
+                this.createGroupBracket(firstStaffLine, firstStaffLine, recursionDepth);
             }
             if (instrumentGroup.InstrumentalGroups.length < 1) {
                 continue;
@@ -416,11 +400,11 @@ export abstract class MusicSystem extends GraphicalObject {
         throw new Error("not implemented");
     }
 
-    protected createInstrumentBracket(rightUpper: PointF2D, rightLower: PointF2D): void {
+    protected createInstrumentBracket(firstStaffLine: StaffLine, lastStaffLine: StaffLine): void {
         throw new Error("not implemented");
     }
 
-    protected createGroupBracket(rightUpper: PointF2D, rightLower: PointF2D, staffHeight: number, recursionDepth: number): void {
+    protected createGroupBracket(firstStaffLine: StaffLine, lastStaffLine: StaffLine, recursionDepth: number): void {
         throw new Error("not implemented");
     }
 

+ 3 - 3
src/MusicalScore/Graphical/VexFlow/VexFlowMusicSystem.ts

@@ -1,12 +1,12 @@
 import {MusicSystem} from "../MusicSystem";
 import {GraphicalMusicPage} from "../GraphicalMusicPage";
 import {SystemLinesEnum} from "../SystemLinesEnum";
-import {PointF2D} from "../../../Common/DataObjects/PointF2D";
 import {SystemLinePosition} from "../SystemLinePosition";
 import {StaffMeasure} from "../StaffMeasure";
 import {SystemLine} from "../SystemLine";
 import {VexFlowMeasure} from "./VexFlowMeasure";
 import {VexFlowConverter} from "./VexFlowConverter";
+import {StaffLine} from "../StaffLine";
 
 export class VexFlowMusicSystem extends MusicSystem {
     constructor(parent: GraphicalMusicPage, id: number) {
@@ -47,7 +47,7 @@ export class VexFlowMusicSystem extends MusicSystem {
      * @param rightUpper the upper right corner point of the bracket to create
      * @param rightLower the lower right corner point of the bracket to create
      */
-    protected createInstrumentBracket(rightUpper: PointF2D, rightLower: PointF2D): void {
+    protected createInstrumentBracket(firstStaffLine: StaffLine, lastStaffLine: StaffLine): void {
         return;
     }
 
@@ -60,7 +60,7 @@ export class VexFlowMusicSystem extends MusicSystem {
      * @param staffHeight
      * @param recursionDepth
      */
-    protected createGroupBracket(rightUpper: PointF2D, rightLower: PointF2D, staffHeight: number, recursionDepth: number): void {
+    protected createGroupBracket(firstStaffLine: StaffLine, lastStaffLine: StaffLine, recursionDepth: number): void {
         return;
     }
 }