rewriting the slider-port to not use jquery ui slider. slider-port
authorhamidouk
Thu, 10 Nov 2011 17:34:20 +0100
branchslider-port
changeset 229 808768eb5930
parent 228 53d8d95a0079
child 230 9b86d3c52211
rewriting the slider-port to not use jquery ui slider.
src/css/LdtPlayer.css
src/js/widgets/segmentsWidget.js
src/js/widgets/sliderWidget.js
--- a/src/css/LdtPlayer.css	Thu Nov 10 17:25:30 2011 +0100
+++ b/src/css/LdtPlayer.css	Thu Nov 10 17:34:20 2011 +0100
@@ -200,3 +200,20 @@
 			font-family: "Trebuchet MS", "Helvetica", "Arial", "Verdana", "sans-serif";
 			overflow:hidden;
 		}
+    
+    .SliderWidget {
+    
+    }
+    /* slider */
+    .sliderBackground  {
+      background-color: #B6B8B8;
+      width: 100%;
+      padding-top: 5px;
+    }
+    
+    .sliderForeground  {
+      background-color: #747474;
+      padding-top: 5px;
+      z-index: 2;
+      width: 0px;
+    }
--- a/src/js/widgets/segmentsWidget.js	Thu Nov 10 17:25:30 2011 +0100
+++ b/src/js/widgets/segmentsWidget.js	Thu Nov 10 17:34:20 2011 +0100
@@ -18,7 +18,7 @@
   var annotations = this._serializer._data.annotations;
 
   this.selector.css("overflow", "auto"); // clear the floats - FIXME : to refactor ?
-  this.selector.append(Mustache.to_html(IriSP.segment_marker_template));
+  this.selector.append(Mustache.to_html(IriSP.overlay_marker_template));
   
   this.positionMarker = this.selector.children(":first");
   
--- a/src/js/widgets/sliderWidget.js	Thu Nov 10 17:25:30 2011 +0100
+++ b/src/js/widgets/sliderWidget.js	Thu Nov 10 17:34:20 2011 +0100
@@ -7,27 +7,25 @@
 IriSP.SliderWidget.prototype.draw = function() {
   var self = this;
   
-  this.selector.slider( { //range: "min",
-    value: 0,
-    min: 1,
-    max: this._serializer.currentMedia().meta["dc:duration"]/1000,//1:54:52.66 = 3600+3240+
-    step: 0.1,
-    slide: function(event, ui) {     
-      self._Popcorn.currentTime(ui.value);
-    },
-    /* change event is similar to slide, but it happens when the slider position is 
-       modified programatically. We use it for unit tests */       
-    change: function(event, ui) {      
-      self._Popcorn.trigger("test.fixture", ui.value);
-    }
-    
-  });
+  this.selector.append("<div class='sliderBackground'></div>");
+  this.sliderBackground = this.selector.children(".sliderBackground");
+  
+  this.selector.append("<div class='sliderForeground' style='position: absolute; top: 0%; width: 0%;'></div>");
+  this.sliderForeground = this.selector.children(".sliderForeground");
+  
+  this.selector.append(Mustache.to_html(IriSP.overlay_marker_template));
+  this.positionMarker = this.selector.children(".positionMarker");
   
   this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.sliderUpdater));
 };
 
 /* updates the slider as time passes */
 IriSP.SliderWidget.prototype.sliderUpdater = function() {  
-  var currentPosition = this._Popcorn.currentTime();   
-	this.selector.slider( "value", currentPosition);		
+  var time = this._Popcorn.currentTime();
+  
+  var duration = this._serializer.currentMedia().meta["dc:duration"] / 1000;
+  var percent = ((time / duration) * 100).toFixed(2);
+	this.sliderForeground.css("width", percent + "%");
+	this.positionMarker.css("left", percent + "%");
+  
 };
\ No newline at end of file