Mercurial > hg > ugly-duckling
diff src/app/playhead/waves-ui-play-head.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 | 7e6b9b557179 |
children |
line wrap: on
line diff
--- a/src/app/playhead/waves-ui-play-head.component.ts Wed Jul 05 17:28:24 2017 +0100 +++ b/src/app/playhead/waves-ui-play-head.component.ts Wed Jul 05 18:42:12 2017 +0100 @@ -10,7 +10,7 @@ QueryList } from '@angular/core'; import { - LayerRemover, + LayerRemover, PlayheadRenderer, WavesComponent } from '../visualisations/waves-base.component'; import Waves from 'waves-ui-piper'; @@ -27,7 +27,7 @@ }) export class WavesPlayHeadComponent implements AfterViewInit, OnDestroy { - @ContentChildren(WavesComponent) wavesChildren: QueryList<WavesComponent<any>>; + @ContentChildren(PlayheadRenderer) wavesChildren: QueryList<PlayheadRenderer>; @Input() colour: string; @Input() set isActive(isActive: boolean) { this.mIsActive = isActive; @@ -63,17 +63,13 @@ private setupAnimatedPlayheads(): void { if (this.wavesChildren && this.mIsActive) { this.wavesChildren.forEach(component => { - const cursor = new Waves.helpers.CursorLayer({ - height: component.height, - color: this.colour, - }); - cursor.currentPosition = this.player.getCurrentTime(); + const cursor = component.renderPlayhead( + this.player.getCurrentTime(), + this.colour + ); this.removers.push( - component.addLayer(cursor), - this.renderLoop.addPlayingTask(currentTime => { - cursor.currentPosition = currentTime; - cursor.update(); - }) + cursor.remove, + this.renderLoop.addPlayingTask(cursor.update) ); }); }