added some code to move the arrow (WIP). popcorn-port
authorhamidouk
Mon, 24 Oct 2011 12:43:13 +0200
branchpopcorn-port
changeset 126 e007a7ad66b8
parent 125 960ce0b9f9f0
child 127 3ce493c93d6c
added some code to move the arrow (WIP).
src/js/widgets/segmentsWidget.js
--- a/src/js/widgets/segmentsWidget.js	Mon Oct 24 12:42:45 2011 +0200
+++ b/src/js/widgets/segmentsWidget.js	Mon Oct 24 12:43:13 2011 +0200
@@ -47,6 +47,21 @@
     IriSP.jQuery("#" + id).click(function(_this, annotation) { 
                                     return function() { _this.clickHandler(annotation)};
                                  }(this, annotation));
+
+    // also add an handler to move the arrow.
+    // FIXME: make it work - the arrow swings wildly atm.
+    var middle = IriSP.timeToPourcent(begin + (end - begin)/ 2, duration);
+    var arrow_div_width = IriSP.jQuery("#Ldt-Show-Arrow").width();
+    
+    var real_middle = middle - (middle * (1 - this.width/arrow_div_width));
+    var conf = {start: begin, end: end, 
+                onStart: 
+                       function(middle) {                         
+                        return function() { 
+                          console.log(middle, real_middle);
+                          IriSP.jQuery("#Ldt-Show-Arrow").animate({left: real_middle + '%'}, 1000); }}(middle)                
+                };
+    this._Popcorn = this._Popcorn.code(conf);
   }
 };