changeset 175:afb32197635d

Merge branch 'master' of github.com:LucasThompson/ugly-duckling into feature/list-analysis-cards
author Lucas Thompson <dev@lucas.im>
date Tue, 21 Mar 2017 17:43:25 +0000
parents 8f50e2b220e8 (current diff) 28cb8530300b (diff)
children 8b34bc784d80
files
diffstat 1 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/app/waveform/waveform.component.ts	Tue Mar 21 17:12:32 2017 +0000
+++ b/src/app/waveform/waveform.component.ts	Tue Mar 21 17:43:25 2017 +0000
@@ -56,6 +56,7 @@
   private initialZoom: number;
   private initialDistance: number;
   private zoomOnMouseDown: number;
+  private offsetOnMouseDown: number;
 
   constructor(private audioService: AudioPlayerService,
               private piperService: FeatureExtractionService,
@@ -443,11 +444,16 @@
         // TODO refactor, this is incomprehensible
         if (isMarker) {
           const plotData = featureData.map(feature => {
-            return {time: toSeconds(feature.timestamp)}
+            return {
+              time: toSeconds(feature.timestamp),
+              label: feature.label
+            }
           });
           let featureLayer = new wavesUI.helpers.TickLayer(plotData, {
             height: height,
             color: colour,
+            labelPosition: 'bottom',
+            shadeSegments: true
           });
           this.addLayer(
             featureLayer,
@@ -639,10 +645,15 @@
 
   seekStart(): void {
     this.zoomOnMouseDown = this.timeline.timeContext.zoom;
+    this.offsetOnMouseDown = this.timeline.timeContext.offset;
   }
 
   seekEnd(x: number): void {
-    if (this.zoomOnMouseDown === this.timeline.timeContext.zoom) {
+    const hasSameZoom: boolean = this.zoomOnMouseDown ===
+      this.timeline.timeContext.zoom;
+    const hasSameOffset: boolean = this.offsetOnMouseDown ===
+      this.timeline.timeContext.offset;
+    if (hasSameZoom && hasSameOffset) {
       this.seek(x);
     }
   }