Mercurial > hg > ugly-duckling
comparison src/app/app.component.ts @ 436:d2af14e0b949
No need to close the tray programmatically, can do it in the template.
author | Lucas Thompson <dev@lucas.im> |
---|---|
date | Wed, 07 Jun 2017 15:45:29 +0100 |
parents | b0415f8837d9 |
children | 8113b6f5a75e |
comparison
equal
deleted
inserted
replaced
435:a1562ee60ed4 | 436:d2af14e0b949 |
---|---|
1 import {Component, OnDestroy, ViewChild} from '@angular/core'; | 1 import {Component, OnDestroy} from '@angular/core'; |
2 import { | 2 import { |
3 AudioPlayerService, | 3 AudioPlayerService, |
4 AudioResourceError, AudioResource | 4 AudioResourceError, AudioResource |
5 } from './services/audio-player/audio-player.service'; | 5 } from './services/audio-player/audio-player.service'; |
6 import {FeatureExtractionService} from './services/feature-extraction/feature-extraction.service'; | 6 import {FeatureExtractionService} from './services/feature-extraction/feature-extraction.service'; |
12 AnalysisItem, | 12 AnalysisItem, |
13 isRootAudioItem, | 13 isRootAudioItem, |
14 Item, PendingAnalysisItem, PendingRootAudioItem, RootAudioItem | 14 Item, PendingAnalysisItem, PendingRootAudioItem, RootAudioItem |
15 } from './analysis-item/analysis-item.component'; | 15 } from './analysis-item/analysis-item.component'; |
16 import {OnSeekHandler} from './playhead/PlayHeadHelpers'; | 16 import {OnSeekHandler} from './playhead/PlayHeadHelpers'; |
17 import {ActionTrayComponent} from "./actions/action-tray.component"; | |
18 | 17 |
19 class PersistentStack<T> { | 18 class PersistentStack<T> { |
20 private stack: T[]; | 19 private stack: T[]; |
21 private history: T[][]; | 20 private history: T[][]; |
22 | 21 |
70 selector: 'ugly-root', | 69 selector: 'ugly-root', |
71 templateUrl: './app.component.html', | 70 templateUrl: './app.component.html', |
72 styleUrls: ['./app.component.css'] | 71 styleUrls: ['./app.component.css'] |
73 }) | 72 }) |
74 export class AppComponent implements OnDestroy { | 73 export class AppComponent implements OnDestroy { |
75 @ViewChild(ActionTrayComponent) tray: ActionTrayComponent; | |
76 audioBuffer: AudioBuffer; // TODO consider revising | 74 audioBuffer: AudioBuffer; // TODO consider revising |
77 canExtract: boolean; | 75 canExtract: boolean; |
78 private onAudioDataSubscription: Subscription; | 76 private onAudioDataSubscription: Subscription; |
79 private onProgressUpdated: Subscription; | 77 private onProgressUpdated: Subscription; |
80 private analyses: PersistentStack<Item>; // TODO some immutable state container describing entire session | 78 private analyses: PersistentStack<Item>; // TODO some immutable state container describing entire session |
81 private nRecordings: number; // TODO user control for naming a recording | 79 private nRecordings: number; // TODO user control for naming a recording |
82 private countingId: number; // TODO improve uniquely identifying items | 80 private countingId: number; // TODO improve uniquely identifying items |
83 private rootAudioItem: RootAudioItem; | 81 private rootAudioItem: RootAudioItem; |
84 private onSeek: OnSeekHandler; | 82 private onSeek: OnSeekHandler; |
85 private closeTray: () => void; | |
86 | 83 |
87 constructor(private audioService: AudioPlayerService, | 84 constructor(private audioService: AudioPlayerService, |
88 private featureService: FeatureExtractionService, | 85 private featureService: FeatureExtractionService, |
89 private iconRegistry: MdIconRegistry, | 86 private iconRegistry: MdIconRegistry, |
90 private sanitizer: DomSanitizer) { | 87 private sanitizer: DomSanitizer) { |
143 {progress: progress.value} | 140 {progress: progress.value} |
144 ) | 141 ) |
145 ); | 142 ); |
146 } | 143 } |
147 ); | 144 ); |
148 this.closeTray = () => { | |
149 this.tray.toggle(); | |
150 }; | |
151 } | 145 } |
152 | 146 |
153 onFileOpened(file: File | Blob) { | 147 onFileOpened(file: File | Blob) { |
154 this.canExtract = false; | 148 this.canExtract = false; |
155 const url = this.audioService.loadAudio(file); | 149 const url = this.audioService.loadAudio(file); |