view src/app/visualisations/vertical-scale.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 40ea40ebc2b3
line wrap: on
line source
/**
 * Created by lucas on 01/06/2017.
 */
import {VerticalScaleRenderer} from './waves-base.component';
import {
  ChangeDetectionStrategy,
  Component,
  ContentChildren,
  QueryList,
  AfterViewInit
} from '@angular/core';

@Component({
  selector: 'ugly-vertical-scale',
  template: '<ng-content></ng-content>',
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class VerticalScaleComponent implements AfterViewInit {

  @ContentChildren(
    VerticalScaleRenderer
  ) bounded: QueryList<VerticalScaleRenderer>;
  protected cachedRanged: [number, number];

  ngAfterViewInit(): void {
    this.bounded.forEach(component => {
      this.cachedRanged = component.range;
      if (this.cachedRanged) {
        component.renderScale(this.cachedRanged);
      }
    });
  }
}