VexFlowContinuousDynamicExpression.ts 1.6 KB

123456789101112131415161718192021222324252627282930
  1. import { GraphicalContinuousDynamicExpression } from "../GraphicalContinuousDynamicExpression";
  2. import { ContinuousDynamicExpression } from "../../VoiceData/Expressions/ContinuousExpressions/ContinuousDynamicExpression";
  3. import { StaffLine } from "../StaffLine";
  4. import { GraphicalLabel } from "../GraphicalLabel";
  5. import { Label } from "../../Label";
  6. import { TextAlignmentEnum } from "../../../Common/Enums/TextAlignment";
  7. import { FontStyles } from "../../../Common/Enums/FontStyles";
  8. import { SourceMeasure } from "../../VoiceData/SourceMeasure";
  9. /**
  10. * This class extends the GraphicalContinuousDynamicExpression and creates all necessary methods for drawing
  11. */
  12. export class VexFlowContinuousDynamicExpression extends GraphicalContinuousDynamicExpression {
  13. constructor(continuousDynamic: ContinuousDynamicExpression, staffLine: StaffLine,
  14. measure: SourceMeasure, textHeight?: number) {
  15. super(continuousDynamic, staffLine, measure);
  16. if (this.IsVerbal) {
  17. const sourceLabel: Label = new Label(continuousDynamic.Label);
  18. this.label = new GraphicalLabel(sourceLabel,
  19. textHeight ? textHeight : this.rules.ContinuousDynamicTextHeight,
  20. TextAlignmentEnum.LeftCenter,
  21. this.rules,
  22. this.PositionAndShape);
  23. this.label.Label.fontStyle = FontStyles.Italic;
  24. this.label.setLabelPositionAndShapeBorders();
  25. this.PositionAndShape.calculateBoundingBox();
  26. }
  27. }
  28. }