changeset 2560:0c724e7c8c26

#175: Allowed AB to have fixed labels
author Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk>
date Thu, 19 Jan 2017 17:05:20 +0000
parents c40cda1c2839
children f5d8a0af942f 0fafb872a1a3
files interfaces/AB.js
diffstat 1 files changed, 26 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/interfaces/AB.js	Thu Jan 19 16:59:59 2017 +0000
+++ b/interfaces/AB.js	Thu Jan 19 17:05:20 2017 +0000
@@ -360,31 +360,33 @@
             audioObject.bindInterface(orNode);
         } else {
             var label;
-            switch (audioObject.specification.parent.label) {
-                case "none":
-                    label = "";
-                    break;
-                case "number":
-                    label = "" + index;
-                    break;
-                case "letter":
-                    label = String.fromCharCode(97 + index);
-                    break;
-                case "samediff":
-                    console.log("index = " + index); 
-                    if(index == 0){
-                        label = "same";
-                    }
-                    else if (index == 1){
-                        label = "different";
-                    }
-                    else{
+            if (audioObject.specification.label && audioObject.specification.label.length > 0) {
+                label = audioObject.specification.label;
+            } else {
+                switch (audioObject.specification.parent.label) {
+                    case "none":
                         label = "";
-                    }
-                    break;
-                default:
-                    label = String.fromCharCode(65 + index);
-                    break;
+                        break;
+                    case "number":
+                        label = "" + index;
+                        break;
+                    case "letter":
+                        label = String.fromCharCode(97 + index);
+                        break;
+                    case "samediff":
+                        console.log("index = " + index);
+                        if (index == 0) {
+                            label = "same";
+                        } else if (index == 1) {
+                            label = "different";
+                        } else {
+                            label = "";
+                        }
+                        break;
+                    default:
+                        label = String.fromCharCode(65 + index);
+                        break;
+                }
             }
             var node = new this.comparatorBox(audioObject, index, label);
             audioObject.bindInterface(node);