diff src/app/app.component.ts @ 427:b0415f8837d9

Setup extraction menu with a callback for closing the menu on extraction. Place the tray outside the main body to avoid weird scrolling issues when there are enough cards to scroll.
author Lucas Thompson <dev@lucas.im>
date Tue, 06 Jun 2017 22:13:34 +0100
parents 3eab26a629e1
children d2af14e0b949
line wrap: on
line diff
--- a/src/app/app.component.ts	Tue Jun 06 22:11:59 2017 +0100
+++ b/src/app/app.component.ts	Tue Jun 06 22:13:34 2017 +0100
@@ -1,4 +1,4 @@
-import {Component, OnDestroy} from '@angular/core';
+import {Component, OnDestroy, ViewChild} from '@angular/core';
 import {
   AudioPlayerService,
   AudioResourceError, AudioResource
@@ -14,6 +14,7 @@
   Item, PendingAnalysisItem, PendingRootAudioItem, RootAudioItem
 } from './analysis-item/analysis-item.component';
 import {OnSeekHandler} from './playhead/PlayHeadHelpers';
+import {ActionTrayComponent} from "./actions/action-tray.component";
 
 class PersistentStack<T> {
   private stack: T[];
@@ -71,6 +72,7 @@
   styleUrls: ['./app.component.css']
 })
 export class AppComponent implements OnDestroy {
+  @ViewChild(ActionTrayComponent) tray: ActionTrayComponent;
   audioBuffer: AudioBuffer; // TODO consider revising
   canExtract: boolean;
   private onAudioDataSubscription: Subscription;
@@ -80,6 +82,7 @@
   private countingId: number; // TODO improve uniquely identifying items
   private rootAudioItem: RootAudioItem;
   private onSeek: OnSeekHandler;
+  private closeTray: () => void;
 
   constructor(private audioService: AudioPlayerService,
               private featureService: FeatureExtractionService,
@@ -142,6 +145,9 @@
         );
       }
     );
+    this.closeTray = () => {
+      this.tray.toggle();
+    };
   }
 
   onFileOpened(file: File | Blob) {