src/js/widgets/arrowWidget.js
branchpopcorn-port
changeset 313 7df805ebb75e
parent 305 e8d05c3f77ed
child 321 21d840371c6b
equal deleted inserted replaced
312:228b27fd2a7c 313:7df805ebb75e
    18   this.selector.append(templ);
    18   this.selector.append(templ);
    19   this._Popcorn.listen("IriSP.SegmentsWidget.segmentClick", IriSP.wrap(this, this.segmentClickHandler));
    19   this._Popcorn.listen("IriSP.SegmentsWidget.segmentClick", IriSP.wrap(this, this.segmentClickHandler));
    20 };
    20 };
    21 
    21 
    22 IriSP.ArrowWidget.prototype.segmentClickHandler = function(percents) {
    22 IriSP.ArrowWidget.prototype.segmentClickHandler = function(percents) {
    23  this.selector.children(".Ldt-arrowWidget").css("left", percents + "%");
    23  // we need to apply a fix because the arrow has a certain length
       
    24  // it's half the length of the arrow (27 / 2). We need to convert
       
    25  // it in percents though.
       
    26  var totalWidth = this.selector.width();
       
    27  var correction = ((27 / 2) / totalWidth) * 100;
       
    28  var corrected_percents = percents - correction;
       
    29  this.selector.children(".Ldt-arrowWidget").animate({"left" : corrected_percents + "%"});
    24 }
    30 }