-
Notifications
You must be signed in to change notification settings - Fork 204
/
Copy pathTempoEffectInfo.ts
43 lines (36 loc) · 1.4 KB
/
TempoEffectInfo.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
38
39
40
41
42
43
import { Beat } from '@src/model/Beat';
import { BarRendererBase } from '@src/rendering/BarRendererBase';
import { EffectBarGlyphSizing } from '@src/rendering/EffectBarGlyphSizing';
import { EffectGlyph } from '@src/rendering/glyphs/EffectGlyph';
import { EffectBarRendererInfo } from '@src/rendering/EffectBarRendererInfo';
import { Settings } from '@src/Settings';
import { NotationElement } from '@src/NotationSettings';
import { BarTempoGlyph } from '../glyphs/BarTempoGlyph';
export class TempoEffectInfo extends EffectBarRendererInfo {
public get notationElement(): NotationElement {
return NotationElement.EffectTempo;
}
public get hideOnMultiTrack(): boolean {
return true;
}
public get canShareBand(): boolean {
return false;
}
public get sizingMode(): EffectBarGlyphSizing {
return EffectBarGlyphSizing.SinglePreBeat;
}
public shouldCreateGlyph(settings: Settings, beat: Beat): boolean {
return (
beat.voice.bar.staff.index === 0 &&
beat.voice.index === 0 &&
beat.index === 0 &&
beat.voice.bar.masterBar.tempoAutomations.length > 0
);
}
public createNewGlyph(renderer: BarRendererBase, beat: Beat): EffectGlyph {
return new BarTempoGlyph(beat.voice.bar.masterBar.tempoAutomations);
}
public canExpand(from: Beat, to: Beat): boolean {
return true;
}
}