# HG changeset patch # User Lucas Thompson # Date 1496307757 -3600 # Node ID 5f775358c3cf0341df076b264c07b5728ab2efaa # Parent 2ec1e795f46c2e5c9ec30056b3c39780010fdd96 Introduce vertical-scale component which is a polymorphic container, the child components know how to render their own scales. diff -r 2ec1e795f46c -r 5f775358c3cf src/app/app.module.ts --- a/src/app/app.module.ts Wed May 31 19:31:56 2017 +0100 +++ b/src/app/app.module.ts Thu Jun 01 10:02:37 2017 +0100 @@ -36,6 +36,7 @@ import {NotesComponent} from './visualisations/notes/notes.component'; import {InstantsComponent} from './visualisations/instants/instants.component'; import {GridComponent} from './visualisations/grid/grid.component'; +import {VerticalScaleComponent} from "./visualisations/vertical-scale.component"; export function createAudioContext(): AudioContext { return new ( @@ -128,7 +129,8 @@ TracksComponent, NotesComponent, InstantsComponent, - GridComponent + GridComponent, + VerticalScaleComponent ], imports: [ BrowserModule, diff -r 2ec1e795f46c -r 5f775358c3cf src/app/visualisations/vertical-scale.component.ts --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/app/visualisations/vertical-scale.component.ts Thu Jun 01 10:02:37 2017 +0100 @@ -0,0 +1,30 @@ +/** + * Created by lucas on 01/06/2017. + */ +import {VerticallyBounded} from "./waves-base.component"; +import { + ChangeDetectionStrategy, + Component, + ContentChildren, + QueryList, + AfterViewInit +} from "@angular/core"; + +@Component({ + selector: 'ugly-vertical-scale', + template: '', + changeDetection: ChangeDetectionStrategy.OnPush +}) +export class VerticalScaleComponent implements AfterViewInit { + + @ContentChildren(VerticallyBounded) bounded: QueryList; + + ngAfterViewInit(): void { + this.bounded.forEach(component => { + const range = component.range; + if (range) { + component.renderScale(range); + } + }); + } +}