client/annotviz/app/js/pianoroll.js
changeset 94 e0e514c5470f
parent 93 79ae42ad97d4
child 95 806739a26858
equal deleted inserted replaced
93:79ae42ad97d4 94:e0e514c5470f
    15 
    15 
    16 
    16 
    17 function PianoRoll(options) {
    17 function PianoRoll(options) {
    18     var _this = this;
    18     var _this = this;
    19     this.container = new PIXI.DisplayObjectContainer();
    19     this.container = new PIXI.DisplayObjectContainer();
    20     this.container.position.x = options.xInit;
    20     this.container.x = options.xInit;
    21     this.container.position.y = options.yInit;
    21     this.container.y = options.yInit;
    22     options.parentContainer.addChild(this.container);
    22     options.parentContainer.addChild(this.container);
    23 
    23 
    24     this.linesDown = options.linesDown;
    24     this.linesDown = options.linesDown;
    25     this.height = options.height;
    25     this.height = options.height;
    26     this.pixelsPerSecond = options.pixelsPerSecond;
    26     this.pixelsPerSecond = options.pixelsPerSecond;
    31     this.lineInterval = options.lineInterval;
    31     this.lineInterval = options.lineInterval;
    32     this.offsetMusic = options.offsetMusic || false;
    32     this.offsetMusic = options.offsetMusic || false;
    33     this.noteHeight = options.noteHeight;
    33     this.noteHeight = options.noteHeight;
    34     this.noteDict = {};
    34     this.noteDict = {};
    35     this.startTs = options.startTs || Date.now();
    35     this.startTs = options.startTs || Date.now();
       
    36 
       
    37     var started = false;
    36 
    38 
    37 
    39 
    38     //TODO: I do not like the "regColor" object. This should not be global, but local
    40     //TODO: I do not like the "regColor" object. This should not be global, but local
    39     this.getColor = function(canal) {
    41     this.getColor = function(canal) {
    40         var color = this.colorsReg[canal];
    42         var color = this.colorsReg[canal];
   190         });
   192         });
   191         //console.log("before : ", nbChilds, ", after : ", _this.container.children.length);
   193         //console.log("before : ", nbChilds, ", after : ", _this.container.children.length);
   192     };
   194     };
   193 
   195 
   194     this.start = function() {
   196     this.start = function() {
   195         if(typeof(this.startTs) === 'undefined') {
   197         if(!started) {
   196             console.log('Container Started');
       
   197             this.startTs = Date.now();
   198             this.startTs = Date.now();
   198             this.addLine();
   199             this.addLine();
   199         }
   200         }
   200         var _this = this;
   201         var _this = this;
   201         this.verticalLinesInterval = window.setInterval(function() { _this.addLine(); }, this.lineInterval);
   202         this.verticalLinesInterval = window.setInterval(function() { _this.addLine(); }, this.lineInterval);