client/annotviz/app/js/annotsroll.js
changeset 106 9b20ddf1fc70
parent 105 25ac8802c189
child 109 8546e2181a73
child 111 a7b72620d227
equal deleted inserted replaced
105:25ac8802c189 106:9b20ddf1fc70
    11 var _ = require('lodash');
    11 var _ = require('lodash');
    12 
    12 
    13 var DEFAULT_ANNOT_COLOR = '#bababa';
    13 var DEFAULT_ANNOT_COLOR = '#bababa';
    14 
    14 
    15 var defaultAnnotStyles = {
    15 var defaultAnnotStyles = {
    16     'label': { font: '16pt Arial Bold', fill: '#65A954' },
    16     'label': { font: '16pt Arial Bold', fill: '#65A954', wordWrap: true},
    17     'text' : { font: '12pt Arial Regular', fill: '#444444' },
    17     'text' : { font: '12pt Arial Regular', fill: '#444444', wordWrap: true},
    18     'user' : { font: '14pt Arial regular', fill: '#666666' },
    18     'user' : { font: '14pt Arial regular', fill: '#666666' },
    19 };
    19 };
    20 
    20 
    21 var defaultOptions = {
    21 var defaultOptions = {
    22     externalRefresh: false,
    22     externalRefresh: false,
    43     this.annotColors = opts.annotColors;
    43     this.annotColors = opts.annotColors;
    44     this.startTs = options.startTs || Date.now();
    44     this.startTs = options.startTs || Date.now();
    45 
    45 
    46     var yInit = opts.yInit;
    46     var yInit = opts.yInit;
    47     var annotStyles = _(opts.annotStyles).defaults(defaultAnnotStyles).value();
    47     var annotStyles = _(opts.annotStyles).defaults(defaultAnnotStyles).value();
       
    48     for(var style in annotStyles) {
       
    49     	if (annotStyles[style].wordWrap === true){
       
    50     		annotStyles[style].wordWrapWidth = this.widthRoll; 
       
    51     	}
       
    52     }
       
    53     console.log(annotStyles);
    48     var started = false;
    54     var started = false;
    49     var ws = opts.ws;
    55     var ws = opts.ws;
    50     var externalRefresh = opts.externalRefresh;
    56     var externalRefresh = opts.externalRefresh;
    51     var stageView = opts.stageView;
    57     var stageView = opts.stageView;
    52     
    58     
   107             .drawRect(x, y, 10, 3)
   113             .drawRect(x, y, 10, 3)
   108             .endFill();
   114             .endFill();
   109 
   115 
   110         this.container.addChild(graphics);
   116         this.container.addChild(graphics);
   111 
   117 
       
   118         var textHeight = 0;
   112         var catLabel = new PIXI.Text(
   119         var catLabel = new PIXI.Text(
   113             category,
   120             category,
   114             _(annotStyles.label).extend({fill: color}).value()
   121             _(annotStyles.label).extend({fill: color}).value()
   115         );
   122         );
   116         catLabel.x = x + 20;
   123         catLabel.x = x + 20;
   117         catLabel.y = y - 23;
   124         catLabel.y = y - 23;
   118         this.container.addChild(catLabel);
   125         this.container.addChild(catLabel);
   119 
   126         textHeight += (catLabel.height - 23 + 2);
   120         var textHeight = 0;
   127 
   121         if(text) {
   128         if(text) {
   122             var catText = new PIXI.Text(text, annotStyles.text);
   129             var catText = new PIXI.Text(text, annotStyles.text);
   123             catText.x = x + 20;
   130             catText.x = x + 20;
   124             catText.y = y + 2;
   131             catText.y = y + 2;
   125             this.container.addChild(catText);
   132             this.container.addChild(catText);