src/js/widgets/segmentsWidget.js
branchpopcorn-port
changeset 126 e007a7ad66b8
parent 121 607f481ef4c3
child 132 e56122a14240
equal deleted inserted replaced
125:960ce0b9f9f0 126:e007a7ad66b8
    45     });
    45     });
    46     
    46     
    47     IriSP.jQuery("#" + id).click(function(_this, annotation) { 
    47     IriSP.jQuery("#" + id).click(function(_this, annotation) { 
    48                                     return function() { _this.clickHandler(annotation)};
    48                                     return function() { _this.clickHandler(annotation)};
    49                                  }(this, annotation));
    49                                  }(this, annotation));
       
    50 
       
    51     // also add an handler to move the arrow.
       
    52     // FIXME: make it work - the arrow swings wildly atm.
       
    53     var middle = IriSP.timeToPourcent(begin + (end - begin)/ 2, duration);
       
    54     var arrow_div_width = IriSP.jQuery("#Ldt-Show-Arrow").width();
       
    55     
       
    56     var real_middle = middle - (middle * (1 - this.width/arrow_div_width));
       
    57     var conf = {start: begin, end: end, 
       
    58                 onStart: 
       
    59                        function(middle) {                         
       
    60                         return function() { 
       
    61                           console.log(middle, real_middle);
       
    62                           IriSP.jQuery("#Ldt-Show-Arrow").animate({left: real_middle + '%'}, 1000); }}(middle)                
       
    63                 };
       
    64     this._Popcorn = this._Popcorn.code(conf);
    50   }
    65   }
    51 };
    66 };
    52 
    67 
    53 IriSP.SegmentsWidget.prototype.clickHandler = function(annotation) {
    68 IriSP.SegmentsWidget.prototype.clickHandler = function(annotation) {
    54   var begin = Math.round((+ annotation.begin) / 1000);
    69   var begin = Math.round((+ annotation.begin) / 1000);