Mercurial > hg > ugly-duckling
view src/app/playhead/live-play-head.component.ts @ 484:ae96db60f25c
Move extraction toggle button back to right edge.
author | Lucas Thompson <dev@lucas.im> |
---|---|
date | Mon, 03 Jul 2017 20:32:51 +0100 |
parents | 6015f02ef2c6 |
children |
line wrap: on
line source
/** * Created by lucast on 23/05/2017. */ import { ChangeDetectionStrategy, Component, Input, AfterViewInit, ChangeDetectorRef, OnDestroy } from '@angular/core'; import {TimePixelMapper} from './PlayHeadHelpers'; import { RenderLoopService, TaskRemover } from '../services/render-loop/render-loop.service'; @Component({ selector: 'ugly-live-play-head', template: `<ugly-play-head [currentTime]="currentTime" [timeToPixel]="timeToPixel" [colour]="colour"></ugly-play-head>`, changeDetection: ChangeDetectionStrategy.OnPush }) export class LivePlayHeadComponent implements AfterViewInit, OnDestroy { @Input() timeToPixel: TimePixelMapper; @Input() colour: string; private currentTime = 0; private remover: TaskRemover; constructor(private renderLoop: RenderLoopService, private ref: ChangeDetectorRef) {} ngAfterViewInit(): void { this.remover = this.renderLoop.addPlayingTask((currentTime) => { this.currentTime = currentTime; this.ref.markForCheck(); }); } ngOnDestroy(): void { this.remover(); } }