src/js/widgets/sliderWidget.js
branchpopcorn-port
changeset 472 1da76db24aa8
parent 471 af5b1db6fd0b
child 476 3957157b7f96
equal deleted inserted replaced
471:af5b1db6fd0b 472:1da76db24aa8
    43   this._Popcorn.listen("IriSP.PlayerWidget.MouseOut", IriSP.wrap(this, this.mouseOutHandler));
    43   this._Popcorn.listen("IriSP.PlayerWidget.MouseOut", IriSP.wrap(this, this.mouseOutHandler));
    44 };
    44 };
    45 
    45 
    46 /* update the slider and the position marker as time passes */
    46 /* update the slider and the position marker as time passes */
    47 IriSP.SliderWidget.prototype.sliderUpdater = function() {
    47 IriSP.SliderWidget.prototype.sliderUpdater = function() {
    48   if(this.draggingOngoing)
    48   if(this.draggingOngoing || this._disableUpdates)
    49     return;
    49     return;
    50 
    50   
    51   var time = this._Popcorn.currentTime();
    51   var time = this._Popcorn.currentTime();
    52 
    52 
    53   var duration = this._serializer.currentMedia().meta["dc:duration"] / 1000;
    53   var duration = this._serializer.currentMedia().meta["dc:duration"] / 1000;
    54   var percent = ((time / duration) * 100).toFixed(2);
    54   var percent = ((time / duration) * 100).toFixed(2);
    55   
    55   
   135 //  this.selector.addClass("Ldt-SliderMinimized");
   135 //  this.selector.addClass("Ldt-SliderMinimized");
   136 
   136 
   137 };
   137 };
   138 
   138 
   139 // called when the user starts dragging the position indicator
   139 // called when the user starts dragging the position indicator
   140 IriSP.SliderWidget.prototype.positionMarkerDraggingStartedHandler = function(event, ui) {
   140 IriSP.SliderWidget.prototype.positionMarkerDraggingStartedHandler = function(event, ui) {  
   141   this.draggingOngoing = true;
   141   this.draggingOngoing = true;
   142 };
   142 };
   143 
   143 
   144 IriSP.SliderWidget.prototype.positionMarkerDraggedHandler = function(event, ui) {
   144 IriSP.SliderWidget.prototype.positionMarkerDraggedHandler = function(event, ui) {
       
   145   console.log(ui.offset.left);
       
   146   this._disableUpdate = true; // disable slider position updates while dragging is ongoing.
       
   147   window.setTimeout(IriSP.wrap(this, function() { this._disableUpdate = false; }), 500);
       
   148   
   145   var width = this.sliderBackground.width();
   149   var width = this.sliderBackground.width();
   146   var duration = this._serializer.currentMedia().meta["dc:duration"] / 1000;
   150   var duration = this._serializer.currentMedia().meta["dc:duration"] / 1000;
   147   var newTime = ((ui.offset.left / width) * duration).toFixed(2);
   151   var newTime = ((ui.offset.left / width) * duration).toFixed(2);
   148 
   152 
   149   this._Popcorn.currentTime(newTime);
   153   this._Popcorn.currentTime(newTime);