src/js/widgets/sliderWidget.js
branchpopcorn-port
changeset 820 7968346b9689
parent 740 3b60f3beb521
child 838 03b03865eb9b
equal deleted inserted replaced
819:9b8e68803f6f 820:7968346b9689
    50   if(this.draggingOngoing || this._disableUpdate)
    50   if(this.draggingOngoing || this._disableUpdate)
    51     return;
    51     return;
    52   
    52   
    53   var time = this._Popcorn.currentTime();
    53   var time = this._Popcorn.currentTime();
    54 
    54 
    55   var duration = this._serializer.currentMedia().meta["dc:duration"] / 1000;
    55   var duration = this._serializer.getDuration() / 1000;
    56   var percents = time / duration;
    56   var percents = time / duration;
    57   
    57   
    58   /* we do these complicated calculations to center exactly
    58   /* we do these complicated calculations to center exactly
    59      the position Marker */
    59      the position Marker */
    60 
    60 
    90 
    90 
    91   var parentOffset = this.sliderBackground.parent().offset();
    91   var parentOffset = this.sliderBackground.parent().offset();
    92   var width = this.sliderBackground.width();
    92   var width = this.sliderBackground.width();
    93   var relX = event.pageX - parentOffset.left;
    93   var relX = event.pageX - parentOffset.left;
    94 
    94 
    95   var duration = this._serializer.currentMedia().meta["dc:duration"] / 1000;
    95   var duration = this._serializer.getDuration() / 1000;
    96   var newTime = ((relX / width) * duration).toFixed(2);
    96   var newTime = ((relX / width) * duration).toFixed(2);
    97 
    97 
    98   this._Popcorn.currentTime(newTime);
    98   this._Popcorn.currentTime(newTime);
    99 };
    99 };
   100 
   100 
   103 IriSP.SliderWidget.prototype.foregroundClickHandler = function(event) {
   103 IriSP.SliderWidget.prototype.foregroundClickHandler = function(event) {
   104   var parentOffset = this.sliderForeground.parent().offset();
   104   var parentOffset = this.sliderForeground.parent().offset();
   105   var width = this.sliderBackground.width();
   105   var width = this.sliderBackground.width();
   106   var relX = event.pageX - parentOffset.left;
   106   var relX = event.pageX - parentOffset.left;
   107 
   107 
   108   var duration = this._serializer.currentMedia().meta["dc:duration"] / 1000;
   108   var duration = this._serializer.getDuration() / 1000;
   109   var newTime = ((relX / width) * duration).toFixed(2);
   109   var newTime = ((relX / width) * duration).toFixed(2);
   110 
   110 
   111   this._Popcorn.currentTime(newTime);
   111   this._Popcorn.currentTime(newTime);
   112 };
   112 };
   113 
   113 
   159 
   159 
   160   var parentOffset = this.sliderForeground.parent().offset();
   160   var parentOffset = this.sliderForeground.parent().offset();
   161   var width = this.sliderBackground.width();
   161   var width = this.sliderBackground.width();
   162   var relX = event.pageX - parentOffset.left;
   162   var relX = event.pageX - parentOffset.left;
   163 
   163 
   164   var duration = this._serializer.currentMedia().meta["dc:duration"] / 1000;
   164   var duration = this._serializer.getDuration() / 1000;
   165   var newTime = ((relX / width) * duration).toFixed(2);
   165   var newTime = ((relX / width) * duration).toFixed(2);
   166 
   166 
   167   this._Popcorn.currentTime(newTime);
   167   this._Popcorn.currentTime(newTime);
   168   
   168   
   169   this.draggingOngoing = false;
   169   this.draggingOngoing = false;