view src/app/visualisations/instants/instants.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 3ace7672638b
children
line wrap: on
line source
/**
 * Created by lucast on 31/05/2017.
 */
import {PlayheadRenderer, WavesComponent} from '../waves-base.component';
import {
  ChangeDetectionStrategy,
  Component,
  Input,
} from '@angular/core';
import {Instant} from '../FeatureUtilities';
import Waves from 'waves-ui-piper';

@Component({
  selector: 'ugly-instants',
  templateUrl: '../waves-template.html',
  styleUrls: ['../waves-template.css'],
  changeDetection: ChangeDetectionStrategy.OnPush,
  providers: [
    {provide: PlayheadRenderer, useExisting: InstantsComponent},
    {provide: WavesComponent, useExisting: InstantsComponent}
  ]
})
export class InstantsComponent extends WavesComponent<Instant[]> {
  @Input() set instants(instants: Instant[]) {
    this.feature = instants;
  }

  protected get featureLayers(): Layer[] {
    return [
      new Waves.helpers.TickLayer(
        this.feature,
        {
          height: this.height,
          color: this.colour,
          labelPosition: 'bottom',
          shadeSegments: true
        }
      )
    ];
  }
}