client/annotviz/app/js/doubleroll.js
changeset 153 60bd2b36b9dc
parent 152 f0e12afcfba1
equal deleted inserted replaced
152:f0e12afcfba1 153:60bd2b36b9dc
    15 
    15 
    16 var defaultConfig = {
    16 var defaultConfig = {
    17     orientation: 'horizontal',
    17     orientation: 'horizontal',
    18     logger: undefined,
    18     logger: undefined,
    19     sceneWidth: 1024,
    19     sceneWidth: 1024,
       
    20     showTimer: false,
    20     pianorolls : [
    21     pianorolls : [
    21       {
    22       {
    22         height: 384,
    23         height: 384,
    23         timeWidth: 10,
    24         timeWidth: 10,
    24         lineInterval: 5000,
    25         lineInterval: 5000,
    68     this.lineColor = opts.lineColor;
    69     this.lineColor = opts.lineColor;
    69     this.lineFillColor = opts.lineFillColor;
    70     this.lineFillColor = opts.lineFillColor;
    70     this.framerate = opts.framerate;
    71     this.framerate = opts.framerate;
    71     this.offsetMusic = opts.offsetMusic;
    72     this.offsetMusic = opts.offsetMusic;
    72     this.noteColors = opts.noteColors;
    73     this.noteColors = opts.noteColors;
       
    74     this.showTimer = opts.showTimer;
    73 
    75 
    74     var noteHeight = opts.noteHeight;
    76     var noteHeight = opts.noteHeight;
    75     var sceneHeight = opts.sceneHeight || _(opts.pianorolls).reduce(function(s,p) { return s + p.height; }, 0);
    77     var sceneHeight = opts.sceneHeight || _(opts.pianorolls).reduce(function(s,p) { return s + p.height; }, 0);
    76     var timeWidth = opts.timeWidth;
    78     var timeWidth = opts.timeWidth;
    77     var lineInterval = opts.lineInterval;
    79     var lineInterval = opts.lineInterval;
    78     var offsetMusic = opts.offsetMusic;
    80     var offsetMusic = opts.offsetMusic;
    79 
    81 
    80     var sceneWidth = opts.sceneWidth;
    82     var sceneWidth = opts.sceneWidth;
    81     var stageView = opts.stageView;
    83     var stageView = opts.stageView;
    82 
    84 
       
    85     
    83     var zeroShift = opts.zeroShift;
    86     var zeroShift = opts.zeroShift;
    84 
    87 
    85     var ws = opts.ws;
    88     var ws = opts.ws;
    86 
    89 
    87     var colorsReg = {};
    90     var colorsReg = {};
   133                 .endFill();
   136                 .endFill();
   134             _this.container.addChild(lineGraphics);
   137             _this.container.addChild(lineGraphics);
   135         }
   138         }
   136     });
   139     });
   137 
   140 
   138     var currentTimeText = new PIXI.Text('-- : -- : --', { font: '40pt Arial', fill: '#646464' });
   141     if (this.showTimer){
   139     currentTimeText.x = -currentTimeText.width - 60; 
   142 	    var currentTimeText = new PIXI.Text('-- : -- : --', { font: '40pt Arial', fill: '#646464' });
   140     currentTimeText.y = sceneHeight - currentTimeText.height - 30;
   143 	    currentTimeText.x = -currentTimeText.width - 60; 
   141     this.container.addChild(currentTimeText);
   144 	    currentTimeText.y = sceneHeight - currentTimeText.height - 30;
       
   145 	    this.container.addChild(currentTimeText);
       
   146 	}
   142     
   147     
   143     
   148     
   144     if(!isHorizontal) {
   149     if(!isHorizontal) {
   145         this.container.rotation = Math.PI/2; 
   150         this.container.rotation = Math.PI/2; 
   146         this.container.y = sceneHeight;
   151         this.container.y = sceneHeight;
   176     // Init page and intervals
   181     // Init page and intervals
   177     var startTs;
   182     var startTs;
   178     var refreshTimeInterval;
   183     var refreshTimeInterval;
   179 
   184 
   180     this.start = function() {
   185     this.start = function() {
   181     	refreshTimeInterval = setInterval(function() {_this.updateTime();}, 1000);
   186     	if (this.showTimer){
       
   187     		refreshTimeInterval = setInterval(function() {_this.updateTime();}, 1000);
       
   188     	}
   182     	
   189     	
   183         startTs = Date.now();
   190         startTs = Date.now();
   184         pianorollList.forEach(function(c) {
   191         pianorollList.forEach(function(c) {
   185             c.start();
   192             c.start();
   186         });
   193         });