Mercurial > hg > ugly-duckling
comparison src/app/visualisations/vertical-scale.component.ts @ 393:a02e6ec4a9d2
cross-hair-inspector component, much the same technique used for the vertical-scale. Change curve to use it. Doesn't currently animate.
author | Lucas Thompson <dev@lucas.im> |
---|---|
date | Thu, 01 Jun 2017 16:26:52 +0100 |
parents | 5f775358c3cf |
children | 40ea40ebc2b3 |
comparison
equal
deleted
inserted
replaced
392:7ef6c8089801 | 393:a02e6ec4a9d2 |
---|---|
1 /** | 1 /** |
2 * Created by lucas on 01/06/2017. | 2 * Created by lucas on 01/06/2017. |
3 */ | 3 */ |
4 import {VerticallyBounded} from "./waves-base.component"; | 4 import {VerticalScaleRenderer} from './waves-base.component'; |
5 import { | 5 import { |
6 ChangeDetectionStrategy, | 6 ChangeDetectionStrategy, |
7 Component, | 7 Component, |
8 ContentChildren, | 8 ContentChildren, |
9 QueryList, | 9 QueryList, |
10 AfterViewInit | 10 AfterViewInit |
11 } from "@angular/core"; | 11 } from '@angular/core'; |
12 | 12 |
13 @Component({ | 13 @Component({ |
14 selector: 'ugly-vertical-scale', | 14 selector: 'ugly-vertical-scale', |
15 template: '<ng-content></ng-content>', | 15 template: '<ng-content></ng-content>', |
16 changeDetection: ChangeDetectionStrategy.OnPush | 16 changeDetection: ChangeDetectionStrategy.OnPush |
17 }) | 17 }) |
18 export class VerticalScaleComponent implements AfterViewInit { | 18 export class VerticalScaleComponent implements AfterViewInit { |
19 | 19 |
20 @ContentChildren(VerticallyBounded) bounded: QueryList<VerticallyBounded>; | 20 @ContentChildren( |
21 VerticalScaleRenderer | |
22 ) bounded: QueryList<VerticalScaleRenderer>; | |
23 protected cachedRanged: [number, number]; | |
21 | 24 |
22 ngAfterViewInit(): void { | 25 ngAfterViewInit(): void { |
23 this.bounded.forEach(component => { | 26 this.bounded.forEach(component => { |
24 const range = component.range; | 27 this.cachedRanged = component.range; |
25 if (range) { | 28 if (this.cachedRanged) { |
26 component.renderScale(range); | 29 component.renderScale(this.cachedRanged); |
27 } | 30 } |
28 }); | 31 }); |
29 } | 32 } |
30 } | 33 } |