src/js/widgets/arrowWidget.js
branchpopcorn-port
changeset 313 7df805ebb75e
parent 305 e8d05c3f77ed
child 321 21d840371c6b
--- a/src/js/widgets/arrowWidget.js	Wed Nov 23 15:16:48 2011 +0100
+++ b/src/js/widgets/arrowWidget.js	Wed Nov 23 15:45:41 2011 +0100
@@ -20,5 +20,11 @@
 };
 
 IriSP.ArrowWidget.prototype.segmentClickHandler = function(percents) {
- this.selector.children(".Ldt-arrowWidget").css("left", percents + "%");
+ // we need to apply a fix because the arrow has a certain length
+ // it's half the length of the arrow (27 / 2). We need to convert
+ // it in percents though.
+ var totalWidth = this.selector.width();
+ var correction = ((27 / 2) / totalWidth) * 100;
+ var corrected_percents = percents - correction;
+ this.selector.children(".Ldt-arrowWidget").animate({"left" : corrected_percents + "%"});
 }