/
GraphicalInstantaneousDynamicExpression.ts
37 lines (34 loc) · 2.01 KB
/
GraphicalInstantaneousDynamicExpression.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { StaffLine } from "./StaffLine";
import { InstantaneousDynamicExpression } from "../VoiceData/Expressions/InstantaneousDynamicExpression";
import { GraphicalMeasure } from "./GraphicalMeasure";
import { AbstractGraphicalExpression } from "./AbstractGraphicalExpression";
import { SkyBottomLineCalculator } from "./SkyBottomLineCalculator";
import { PlacementEnum } from "../VoiceData/Expressions/AbstractExpression";
import log from "loglevel";
export class GraphicalInstantaneousDynamicExpression extends AbstractGraphicalExpression {
protected mInstantaneousDynamicExpression: InstantaneousDynamicExpression;
protected mMeasure: GraphicalMeasure;
constructor(instantaneousDynamic: InstantaneousDynamicExpression, staffLine: StaffLine, measure: GraphicalMeasure) {
super(staffLine, instantaneousDynamic, measure.parentSourceMeasure);
this.mInstantaneousDynamicExpression = instantaneousDynamic;
this.mMeasure = measure;
}
public updateSkyBottomLine(): void {
const skyBottomLineCalculator: SkyBottomLineCalculator = this.parentStaffLine.SkyBottomLineCalculator;
const left: number = this.PositionAndShape.RelativePosition.x + this.PositionAndShape.BorderMarginLeft;
const right: number = this.PositionAndShape.RelativePosition.x + this.PositionAndShape.BorderMarginRight;
let yValue: number = 0;
switch (this.Placement) {
case PlacementEnum.Above:
yValue = this.PositionAndShape.RelativePosition.y + this.PositionAndShape.BorderMarginTop;
skyBottomLineCalculator.updateSkyLineInRange(left, right, yValue);
break;
case PlacementEnum.Below:
yValue = this.PositionAndShape.RelativePosition.y + this.PositionAndShape.BorderMarginBottom;
skyBottomLineCalculator.updateBottomLineInRange(left, right, yValue);
break;
default:
log.error("Placement for GraphicalInstantaneousDynamicExpression is unknown");
}
}
}