client/annotviz/app/js/annotsroll.js
changeset 106 9b20ddf1fc70
parent 105 25ac8802c189
child 109 8546e2181a73
child 111 a7b72620d227
--- a/client/annotviz/app/js/annotsroll.js	Thu Jan 22 02:21:15 2015 +0100
+++ b/client/annotviz/app/js/annotsroll.js	Thu Jan 22 02:58:41 2015 +0100
@@ -13,8 +13,8 @@
 var DEFAULT_ANNOT_COLOR = '#bababa';
 
 var defaultAnnotStyles = {
-    'label': { font: '16pt Arial Bold', fill: '#65A954' },
-    'text' : { font: '12pt Arial Regular', fill: '#444444' },
+    'label': { font: '16pt Arial Bold', fill: '#65A954', wordWrap: true},
+    'text' : { font: '12pt Arial Regular', fill: '#444444', wordWrap: true},
     'user' : { font: '14pt Arial regular', fill: '#666666' },
 };
 
@@ -45,6 +45,12 @@
 
     var yInit = opts.yInit;
     var annotStyles = _(opts.annotStyles).defaults(defaultAnnotStyles).value();
+    for(var style in annotStyles) {
+    	if (annotStyles[style].wordWrap === true){
+    		annotStyles[style].wordWrapWidth = this.widthRoll; 
+    	}
+    }
+    console.log(annotStyles);
     var started = false;
     var ws = opts.ws;
     var externalRefresh = opts.externalRefresh;
@@ -109,6 +115,7 @@
 
         this.container.addChild(graphics);
 
+        var textHeight = 0;
         var catLabel = new PIXI.Text(
             category,
             _(annotStyles.label).extend({fill: color}).value()
@@ -116,8 +123,8 @@
         catLabel.x = x + 20;
         catLabel.y = y - 23;
         this.container.addChild(catLabel);
+        textHeight += (catLabel.height - 23 + 2);
 
-        var textHeight = 0;
         if(text) {
             var catText = new PIXI.Text(text, annotStyles.text);
             catText.x = x + 20;