comparison src/app/visualisations/curve/curve.component.ts @ 402:f9d5006f76e1

Change curve component to not render vertical scale / highlight by default. Delegate to child TrackComponent for that work, so the curve can be used like tracks, notes etc.
author Lucas Thompson <dev@lucas.im>
date Fri, 02 Jun 2017 19:10:47 +0100
parents 3eab26a629e1
children 3ace7672638b
comparison
equal deleted inserted replaced
401:6015f02ef2c6 402:f9d5006f76e1
2 * Created by lucas on 30/05/2017. 2 * Created by lucas on 30/05/2017.
3 */ 3 */
4 import { 4 import {
5 ChangeDetectionStrategy, 5 ChangeDetectionStrategy,
6 Component, 6 Component,
7 Input 7 Input,
8 ViewChild
8 } from '@angular/core'; 9 } from '@angular/core';
9 import {OnSeekHandler} from '../../playhead/PlayHeadHelpers'; 10 import {OnSeekHandler} from '../../playhead/PlayHeadHelpers';
10 import {VectorFeature} from 'piper/HigherLevelUtilities'; 11 import {VectorFeature} from 'piper/HigherLevelUtilities';
12 import {
13 VerticallyBounded,
14 VerticalScaleRenderer,
15 VerticalValueInspectorRenderer
16 } from '../waves-base.component';
17 import {TracksComponent} from '../tracks/tracks.components';
11 18
12 @Component({ 19 @Component({
13 selector: 'ugly-curve', 20 selector: 'ugly-curve',
14 template: `<ugly-cross-hair-inspector [unit]="unit"> 21 template: `
15 <ugly-tracks 22 <ugly-tracks
16 [timeline]="timeline" 23 [timeline]="timeline"
17 [width]="width" 24 [width]="width"
18 [onSeek]="onSeek" 25 [onSeek]="onSeek"
19 [colour]="colour" 26 [colour]="colour"
20 [tracks]="[curve]" 27 [tracks]="[curve]"
21 ></ugly-tracks> 28 ></ugly-tracks>`,
22 </ugly-cross-hair-inspector>`, 29 changeDetection: ChangeDetectionStrategy.OnPush,
23 changeDetection: ChangeDetectionStrategy.OnPush 30 providers: [
31 {provide: VerticallyBounded, useExisting: CurveComponent },
32 {provide: VerticalScaleRenderer, useExisting: CurveComponent},
33 {provide: VerticalValueInspectorRenderer, useExisting: CurveComponent}
34 ]
24 }) 35 })
25 export class CurveComponent { 36 export class CurveComponent implements VerticalValueInspectorRenderer {
26 @Input() timeline: Timeline; // TODO refactor WaveComponents to have own Timeline, sharing a TimeContext 37 @Input() timeline: Timeline; // TODO refactor WaveComponents to have own Timeline, sharing a TimeContext
27 @Input() onSeek: OnSeekHandler; 38 @Input() onSeek: OnSeekHandler;
28 @Input() width: number; 39 @Input() width: number;
29 @Input() curve: VectorFeature; 40 @Input() curve: VectorFeature;
30 @Input() colour: string; 41 @Input() colour: string;
31 @Input() unit: string; 42 @ViewChild(TracksComponent) tracksComponent: TracksComponent;
43
44 renderInspector(range: [number, number], unit?: string): void {
45 this.tracksComponent.renderInspector(range, unit);
46 }
47
48 get updatePosition(): OnSeekHandler {
49 return this.tracksComponent.updatePosition;
50 }
51
52 renderScale(range: [number, number]): void {
53 this.tracksComponent.renderScale(range);
54 }
55
56 get range(): [number, number] {
57 return this.tracksComponent.range;
58 }
32 } 59 }