comparison src/app/visualisations/grid/grid.component.ts @ 488:64ed45a0bad3

Introduce PlayheadRenderer, implement in the waves base. Make VerticallyBounded and VerticalScaleRenderer generic and remove bin equivalents. Forward calls for a PlayheadRenderer from VerticalScaleComponent on to its children. Also update other components accordingly.
author Lucas Thompson <dev@lucas.im>
date Wed, 05 Jul 2017 18:42:12 +0100
parents e3cbf4c53e5e
children ab43880f1cd5
comparison
equal deleted inserted replaced
487:f2bb5ddae867 488:64ed45a0bad3
1 /** 1 /**
2 * Created by lucast on 31/05/2017. 2 * Created by lucast on 31/05/2017.
3 */ 3 */
4 import { 4 import {
5 VerticallyBinned,
6 VerticallyBinnedWavesComponent, 5 VerticallyBinnedWavesComponent,
7 VerticalBinNameRenderer, 6 WavesComponent, PlayheadRenderer, VerticallyBounded, VerticalScaleRenderer
8 WavesComponent
9 } from '../waves-base.component'; 7 } from '../waves-base.component';
10 import { 8 import {
11 ChangeDetectionStrategy, 9 ChangeDetectionStrategy,
12 Component, 10 Component,
13 Input, 11 Input,
21 selector: 'ugly-grid', 19 selector: 'ugly-grid',
22 templateUrl: '../waves-template.html', 20 templateUrl: '../waves-template.html',
23 styleUrls: ['../waves-template.css'], 21 styleUrls: ['../waves-template.css'],
24 changeDetection: ChangeDetectionStrategy.OnPush, 22 changeDetection: ChangeDetectionStrategy.OnPush,
25 providers: [ 23 providers: [
26 {provide: VerticallyBinned, useExisting: GridComponent }, 24 {provide: VerticallyBounded, useExisting: GridComponent },
27 {provide: VerticalBinNameRenderer, useExisting: GridComponent }, 25 {provide: VerticalScaleRenderer, useExisting: GridComponent},
26 {provide: PlayheadRenderer, useExisting: GridComponent },
28 {provide: WavesComponent, useExisting: GridComponent} 27 {provide: WavesComponent, useExisting: GridComponent}
29 ] 28 ]
30 }) 29 })
31 30
32 export class GridComponent extends VerticallyBinnedWavesComponent<Grid> { 31 export class GridComponent extends VerticallyBinnedWavesComponent<Grid> {
63 } 62 }
64 ) 63 )
65 ]; 64 ];
66 } 65 }
67 66
68 get binNames(): string[] { 67 get range(): string[] {
69 if (!this.feature.binNames || this.feature.binNames.length === 0) { 68 if (!this.feature.binNames || this.feature.binNames.length === 0) {
70 const binCount = (this.feature.data.length > 0 ? 69 const binCount = (this.feature.data.length > 0 ?
71 this.feature.data[0].length : 0); 70 this.feature.data[0].length : 0);
72 for (let i = 0; i < binCount; ++i) { 71 for (let i = 0; i < binCount; ++i) {
73 this.feature.binNames.push(`${i + 1}`); 72 this.feature.binNames.push(`${i + 1}`);