view src/app/visualisations/curve/curve.component.ts @ 394:f45a916eb5b1

Use the cross hair layer for notes, tracks and curve. This involved bodging in unit to ShapedFeatureData, which isn't particularly easy to do because this isn't an encapsulated type. Need to come back to improving this, as I am monkey-patching a unit property onto Arrays etc.
author Lucas Thompson <dev@lucas.im>
date Thu, 01 Jun 2017 18:55:55 +0100
parents a02e6ec4a9d2
children 3eab26a629e1
line wrap: on
line source
/**
 * Created by lucas on 30/05/2017.
 */
import {
  ChangeDetectionStrategy,
  Component,
  Input
} from '@angular/core';
import {OnSeekHandler} from '../../playhead/PlayHeadHelpers';
import {TracksFeature, VectorFeature} from 'piper/HigherLevelUtilities';

@Component({
  selector: 'ugly-curve',
  template: `<ugly-cross-hair-inspector>
    <ugly-tracks
      [timeline]="timeline"
      [width]="width"
      [onSeek]="onSeek"
      [colour]="colour"
      [tracks]="tracks"
    ></ugly-tracks>
  </ugly-cross-hair-inspector>`,
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class CurveComponent {
  @Input() timeline: Timeline; // TODO refactor WaveComponents to have own Timeline, sharing a TimeContext
  @Input() onSeek: OnSeekHandler;
  @Input() width: number;
  @Input() set curve(curve: VectorFeature & {unit?: string}) {
    const tempTracks: TracksFeature & {unit?: string} = [curve];
    tempTracks.unit = curve.unit;
    this.tracks = tempTracks;
  }

  private tracks: TracksFeature & {unit?: string};

  @Input() colour: string;
}