fixed stupid && bug. popcorn-port
authorhamidouk
Fri, 16 Dec 2011 14:55:48 +0100
branchpopcorn-port
changeset 472 1da76db24aa8
parent 471 af5b1db6fd0b
child 473 1a09ab7e7163
fixed stupid && bug.
src/js/widgets/sliderWidget.js
--- a/src/js/widgets/sliderWidget.js	Fri Dec 16 14:14:59 2011 +0100
+++ b/src/js/widgets/sliderWidget.js	Fri Dec 16 14:55:48 2011 +0100
@@ -45,9 +45,9 @@
 
 /* update the slider and the position marker as time passes */
 IriSP.SliderWidget.prototype.sliderUpdater = function() {
-  if(this.draggingOngoing)
+  if(this.draggingOngoing || this._disableUpdates)
     return;
-
+  
   var time = this._Popcorn.currentTime();
 
   var duration = this._serializer.currentMedia().meta["dc:duration"] / 1000;
@@ -137,11 +137,15 @@
 };
 
 // called when the user starts dragging the position indicator
-IriSP.SliderWidget.prototype.positionMarkerDraggingStartedHandler = function(event, ui) {
+IriSP.SliderWidget.prototype.positionMarkerDraggingStartedHandler = function(event, ui) {  
   this.draggingOngoing = true;
 };
 
 IriSP.SliderWidget.prototype.positionMarkerDraggedHandler = function(event, ui) {
+  console.log(ui.offset.left);
+  this._disableUpdate = true; // disable slider position updates while dragging is ongoing.
+  window.setTimeout(IriSP.wrap(this, function() { this._disableUpdate = false; }), 500);
+  
   var width = this.sliderBackground.width();
   var duration = this._serializer.currentMedia().meta["dc:duration"] / 1000;
   var newTime = ((ui.offset.left / width) * duration).toFixed(2);