fixed a margin problem. popcorn-port
authorhamidouk
Thu, 10 Nov 2011 11:44:45 +0100
branchpopcorn-port
changeset 222 0f86664b470d
parent 221 2a83d308dba6
child 223 f14172bdea28
fixed a margin problem.
src/js/widgets/segmentsWidget.js
--- a/src/js/widgets/segmentsWidget.js	Thu Nov 10 11:04:43 2011 +0100
+++ b/src/js/widgets/segmentsWidget.js	Thu Nov 10 11:44:45 2011 +0100
@@ -37,9 +37,20 @@
     var end = Math.round((+ annotation.end) / 1000);
     var duration = this._serializer.currentMedia().meta["dc:duration"] / 1000;
     var id = annotation.id;
-    var startPourcent 	= IriSP.timeToPourcent(begin, duration) + onePxPercent * annotations.length * 2;
-    var endPourcent 	= IriSP.timeToPourcent(end, duration) - startPourcent;
+    var startPourcent 	= IriSP.timeToPourcent(begin, duration);
+    
+    /* some sort of collapsing occurs, so we only have to substract one pixel to each box instead of
+       two
+    */
+    var endPourcent 	= IriSP.timeToPourcent(end, duration) - startPourcent - onePxPercent * 1;
+    
+    /* on the other hand, we have to substract one pixel from the first box because it's the only
+       one to have to effective 1px margins */
+    if (i == 0) {
 
+      endPourcent -= onePxPercent;
+    }
+    
     var divTitle		= annotation.content.title.substr(0,55);
     var color = annotation.content.color