# HG changeset patch # User Lucas Thompson # Date 1496427047 -3600 # Node ID f9d5006f76e1b2a034f0bd6616353d0563954e24 # Parent 6015f02ef2c62c36848ffb2ce4e4affdb4f65f14 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. diff -r 6015f02ef2c6 -r f9d5006f76e1 src/app/visualisations/curve/curve.component.ts --- a/src/app/visualisations/curve/curve.component.ts Fri Jun 02 19:09:31 2017 +0100 +++ b/src/app/visualisations/curve/curve.component.ts Fri Jun 02 19:10:47 2017 +0100 @@ -4,29 +4,56 @@ import { ChangeDetectionStrategy, Component, - Input + Input, + ViewChild } from '@angular/core'; import {OnSeekHandler} from '../../playhead/PlayHeadHelpers'; import {VectorFeature} from 'piper/HigherLevelUtilities'; +import { + VerticallyBounded, + VerticalScaleRenderer, + VerticalValueInspectorRenderer +} from '../waves-base.component'; +import {TracksComponent} from '../tracks/tracks.components'; @Component({ selector: 'ugly-curve', - template: ` + template: ` - `, - changeDetection: ChangeDetectionStrategy.OnPush + >`, + changeDetection: ChangeDetectionStrategy.OnPush, + providers: [ + {provide: VerticallyBounded, useExisting: CurveComponent }, + {provide: VerticalScaleRenderer, useExisting: CurveComponent}, + {provide: VerticalValueInspectorRenderer, useExisting: CurveComponent} + ] }) -export class CurveComponent { +export class CurveComponent implements VerticalValueInspectorRenderer { @Input() timeline: Timeline; // TODO refactor WaveComponents to have own Timeline, sharing a TimeContext @Input() onSeek: OnSeekHandler; @Input() width: number; @Input() curve: VectorFeature; @Input() colour: string; - @Input() unit: string; + @ViewChild(TracksComponent) tracksComponent: TracksComponent; + + renderInspector(range: [number, number], unit?: string): void { + this.tracksComponent.renderInspector(range, unit); + } + + get updatePosition(): OnSeekHandler { + return this.tracksComponent.updatePosition; + } + + renderScale(range: [number, number]): void { + this.tracksComponent.renderScale(range); + } + + get range(): [number, number] { + return this.tracksComponent.range; + } }