changeset 313:a37fe99e1d9d

Add unit to highlight layer
author Chris Cannam <cannam@all-day-breakfast.com>
date Fri, 12 May 2017 15:07:50 +0100
parents e356409f4c45
children e4e216957803
files src/app/waveform/waveform.component.ts
diffstat 1 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/app/waveform/waveform.component.ts	Fri May 12 12:22:46 2017 +0100
+++ b/src/app/waveform/waveform.component.ts	Fri May 12 15:07:50 2017 +0100
@@ -610,6 +610,7 @@
   }
 
   private addLineLayers(features: VectorFeature[],
+                        unit: string,
                         colour: Colour) {
 
     // Winnow out empty features
@@ -678,6 +679,7 @@
     });
 
     // And a single scale layer at left
+    //!!! todo: unit in scale layer
     const scaleLayer = new wavesUI.helpers.ScaleLayer({
       tickColor: colour,
       textColor: colour,
@@ -697,7 +699,8 @@
       height: height,
       color: '#c33c54',
       labelOffset: 38,
-      yDomain: [ min, max ]
+      yDomain: [ min, max ],
+      unit
     });
     this.addLayer(
       this.highlightLayer,
@@ -726,18 +729,23 @@
     const height = this.trackDiv.nativeElement.getBoundingClientRect().height;
     const waveTrack = this.timeline.getTrackById(`wave-${this.trackIdPrefix}`);
 
+    let unit = "";
+    if (outputDescriptor.configured.hasOwnProperty('unit')) {
+      unit = outputDescriptor.configured.unit;
+    }
+
     // TODO refactor all of this
     switch (features.shape) {
 
       case 'vector': {
         const collected = features.collected as VectorFeature;
-        this.addLineLayers([collected], colour);
+        this.addLineLayers([collected], unit, colour);
         break;
       }
 
       case 'tracks': {
         const collected = features.collected as TracksFeature;
-        this.addLineLayers(collected, colour);
+        this.addLineLayers(collected, unit, colour);
         break;
       }