comparison src/app/analysis-item/analysis-item.component.ts @ 348:d17d5038b11a

Wire up as necessary to push the handlers down the tree. This is unfinished.
author Lucas Thompson <dev@lucas.im>
date Thu, 25 May 2017 17:56:14 +0100
parents 2d7da410ba46
children 524f5cd75737
comparison
equal deleted inserted replaced
347:82d476b976e0 348:d17d5038b11a
5 ChangeDetectionStrategy, 5 ChangeDetectionStrategy,
6 Component, 6 Component,
7 Input, 7 Input,
8 OnInit 8 OnInit
9 } from '@angular/core'; 9 } from '@angular/core';
10 import {naivePagingMapper} from '../visualisations/WavesJunk';
11 import {OnSeekHandler, TimePixelMapper} from '../playhead/PlayHeadHelpers';
10 12
11 export interface AnalysisItem { 13 export interface AnalysisItem {
12 rootAudioUri: string; 14 rootAudioUri: string;
13 hasSharedTimeline: boolean; 15 hasSharedTimeline: boolean;
14 isRoot: boolean; 16 isRoot: boolean;
15 extractorKey: string; 17 extractorKey: string;
16 title?: string; 18 title?: string;
17 description?: string; 19 description?: string;
18 id?: string; 20 id?: string;
19 progress?: number; 21 progress?: number;
22 audioData?: AudioBuffer;
20 } 23 }
21 24
22 @Component({ 25 @Component({
23 selector: 'ugly-analysis-item', 26 selector: 'ugly-analysis-item',
24 templateUrl: './analysis-item.component.html', 27 templateUrl: './analysis-item.component.html',
29 32
30 @Input() timeline: Timeline; 33 @Input() timeline: Timeline;
31 @Input() isActive: boolean; 34 @Input() isActive: boolean;
32 @Input() item: AnalysisItem; 35 @Input() item: AnalysisItem;
33 @Input() contentWidth: number; 36 @Input() contentWidth: number;
37 @Input() onSeek: OnSeekHandler;
34 private hasProgressOnInit = false; 38 private hasProgressOnInit = false;
39
40
41 // TODO move
42 private DOES_NOT_BELONG_HERE: TimePixelMapper;
35 43
36 ngOnInit(): void { 44 ngOnInit(): void {
37 this.hasProgressOnInit = this.item.progress != null; 45 this.hasProgressOnInit = this.item.progress != null;
46 this.DOES_NOT_BELONG_HERE = naivePagingMapper(this.timeline);
38 } 47 }
39 48
40 isLoading(): boolean { 49 isLoading(): boolean {
41 return this.hasProgressOnInit && this.item.progress < 100; 50 return this.hasProgressOnInit && this.item.progress < 100;
42 } 51 }
52
53 isAudioItem(): boolean {
54 return this.item &&
55 this.item.isRoot &&
56 this.item.audioData instanceof AudioBuffer;
57 }
43 } 58 }