client/annotviz/app/js/annotsvizview.js
changeset 108 082b64a5c699
parent 105 25ac8802c189
child 110 e4f0c105090d
--- a/client/annotviz/app/js/annotsvizview.js	Thu Jan 22 03:23:08 2015 +0100
+++ b/client/annotviz/app/js/annotsvizview.js	Thu Jan 22 07:04:42 2015 +0100
@@ -13,29 +13,47 @@
 var AnnotsTimeLine = require('./annotstimeline.js');
 var AnnotsRoll = require('./annotsroll.js');
 
-var defaultOptions = {		
+var defaultOptions = {
     xInit: 0,
     yInit: 0,
     width: 1024,
     height: 768,
+    annotCategories: [{
+        ts: 0,
+        colors: {
+            'ntm': '#CDC83F',
+            'iam': '#CDC83F',
+            'hip': '#CDC83F',
+            'hop': '#CDC83F',
+            'rock': '#DE8B53',
+            'rap': '#DE8B53',
+            'classic': '#DE8B53',
+            'drums': '#C5A3CA',
+            'guitar': '#C5A3CA',
+            'bass': '#79BB92',
+            'default': '#808080'
+        },
+        order: ['ntm', 'iam', 'hip', 'hop', 'rock', 'rap', 'classic', 'drums', 'guitar', 'bass', 'default']
+    }]
 };
 
 function AnnotsVizView(options){
 	var _this = this;
     var opts = _(options).defaults(defaultOptions).value();
-    
+
     this.container = new PIXI.DisplayObjectContainer();
     this.container.x = opts.xInit;
     this.container.y = opts.yInit;
 	this.width = opts.width;
 	this.height= opts.height;
-	
+    this.annotCategories = opts.annotCategories;
+
 	var wsPianoroll = opts.wsPianoroll;
 	var wsAnnot = opts.wsAnnot;
 	var stageView = opts.stageView;
-	
+
 	stageView.registerComponent(this);
-	
+
 	var timeLine = new AnnotsTimeLine.AnnotsTimeLine({
     	stageView : stageView,
         logger: logger,
@@ -50,25 +68,9 @@
         intervalHeight: 10,
         maxCellHeight: 70,
         radius: 200,
-        annotCategories: [{
-       		ts: 0, 
-       		colors: {		
-   	       		'ntm': '#CDC83F',
-   	       	    'iam': '#CDC83F',
-   	       	    'hip': '#CDC83F',
-   	       	    'hop': '#CDC83F',
-   	       	    'rock': '#DE8B53',
-   	       	    'rap': '#DE8B53',
-   	       	    'classic': '#DE8B53',
-   	       	    'drums': '#C5A3CA',
-   	       	    'guitar': '#C5A3CA',
-   	       	    'bass': '#79BB92',
-   	       	   	'default': '#808080'
-			},
-        	order: ['ntm', 'iam', 'hip', 'hop', 'rock', 'rap', 'classic', 'drums', 'guitar', 'bass', 'default']
-       	}]
+        annotCategories: this.annotCategories
     });
-	
+
 	var doubleRollH = new DoubleRoll.DoubleRoll({
         stageView : stageView,
     	logger: logger,
@@ -84,7 +86,7 @@
             },
         ]
     });
-	
+
 	var doubleRollV = new DoubleRoll.DoubleRoll({
         stageView : stageView,
     	logger: logger,
@@ -100,7 +102,7 @@
             },
         ]
     });
-	
+
 	var annotsRoll = new AnnotsRoll.AnnotsRoll({
     	stageView : stageView,
         logger: logger,
@@ -113,24 +115,9 @@
         widthRoll: 200,
         framerate: doubleRollV.framerate,
         pixelsPerSecond: Math.floor(1024 / 60),
-        annotColors: [{
-        	ts: 0, 
-        	colors: {		
-   	       		'ntm': '#CDC83F',
-   	       	    'iam': '#CDC83F',
-   	       	    'hip': '#CDC83F',
-   	       	    'hop': '#CDC83F',
-   	       	    'rock': '#DE8B53',
-   	       	    'rap': '#DE8B53',
-   	       	    'classic': '#DE8B53',
-   	       	    'drums': '#C5A3CA',
-   	       	    'guitar': '#C5A3CA',
-   	       	    'bass': '#79BB92',
-   	       	   	'default': '#808080'
-			}
-        }]
+        annotColors: this.annotCategories
     });
-	
+
 	var limiters = new PIXI.Graphics()
 		.lineStyle(1, 0x646464)
 		.moveTo(annotsRoll.container.x, annotsRoll.container.y)
@@ -144,26 +131,26 @@
 		.drawRect(1024 - 200, 0, 200, 768-200)
 		.endFill();
 	this.container.addChild(limiters);
-	
+
 //	var doubleRollV = new DoubleRoll.DoubleRoll({});
-	
+
 	this.init = function(){
-		
+
 	}
-	
+
 	this.start = function() {
     };
-    
+
     this.refresh = function() {
     };
-    
+
     this.stop = function(){
     };
-    
+
     return this;
-	
+
 }
 
 module.exports = {
 	AnnotsVizView: AnnotsVizView
-};
\ No newline at end of file
+};