Browse Source

refactor: skyline for decrescendo: clearer case handling, comments

ContDynamicEnum.diminuendo will be refactored to decrescendo after this, must be misnamed.
sschmid 5 years ago
parent
commit
e35dfa43ed

+ 6 - 2
src/MusicalScore/Graphical/GraphicalContinuousDynamicExpression.ts

@@ -72,10 +72,14 @@ export class GraphicalContinuousDynamicExpression extends AbstractGraphicalExpre
         switch (this.Placement) {
             case PlacementEnum.Above:
                 if (!this.IsVerbal) {
-                    if (this.ContinuousDynamic.DynamicType === ContDynamicEnum.diminuendo) {
+                    // for now there is only crescendo or decrescendo anyways, but let's check anyways, in case we add new types in the future
+                    if (this.ContinuousDynamic.DynamicType === ContDynamicEnum.crescendo) {
+                        skyBottomLineCalculator.updateSkyLineWithWedge(this.lines[0].Start, this.lines[0].End);
+                    } else if (this.ContinuousDynamic.DynamicType === ContDynamicEnum.diminuendo) {
                         skyBottomLineCalculator.updateSkyLineWithWedge(this.lines[0].End, this.lines[0].Start);
                     } else {
-                        skyBottomLineCalculator.updateSkyLineWithWedge(this.lines[0].Start, this.lines[0].End);
+                        log.info("GraphicalContinuousDynamicExpression.updateSkyBottomLine(): " +
+                        "unhandled continuous dynamic type. start measure: " + this.startMeasure.MeasureNumber);
                     }
                 } else {
                     const yValue: number = this.label.PositionAndShape.BorderMarginTop + this.label.PositionAndShape.RelativePosition.y;

+ 2 - 2
src/MusicalScore/Graphical/SkyBottomLineCalculator.ts

@@ -166,8 +166,8 @@ export class SkyBottomLineCalculator {
 
     /**
      * This method updates the SkyLine for a given Wedge.
-     * @param start Start point of the wedge
-     * @param end End point of the wedge
+     * @param start Start point of the wedge (the point where both lines meet)
+     * @param end End point of the wedge (the end of the most extreme line: upper line for skyline, lower line for bottomline)
      */
     public updateSkyLineWithWedge(start: PointF2D, end: PointF2D): void {
         // FIXME: Refactor if wedges will be added. Current status is that vexflow will be used for this