fixed update bug. popcorn-port
authorhamidouk
Tue, 17 Jan 2012 11:00:33 +0100
branchpopcorn-port
changeset 645 0c8ca890c9f1
parent 644 492d3c8d776a
child 646 2b8b2a94ee92
fixed update bug.
src/js/widgets/createAnnotationWidget.js
src/js/widgets/sparklineWidget.js
--- a/src/js/widgets/createAnnotationWidget.js	Mon Jan 16 17:27:23 2012 +0100
+++ b/src/js/widgets/createAnnotationWidget.js	Tue Jan 17 11:00:33 2012 +0100
@@ -271,10 +271,10 @@
     }
   } else {
     var duration = +this._serializer.currentMedia().meta["dc:duration"];    
-    annotation["begin"] = +((duration * (this.sliceLeft / this.selector.width())).toFixed(0));
-    annotation["end"] = +((duration * ((this.sliceWidth + this.sliceLeft) / this.selector.width())).toFixed(0));
+    annotation["begin"] = +((duration * (this.sliceLeft / 100)).toFixed(0));
+    annotation["end"] = +((duration * ((this.sliceWidth + this.sliceLeft) / 100)).toFixed(0));
   }
-
+  
   annotation["type"] = this._serializer.getContributions();
   if (typeof(annotation["type"]) === "undefined")
     annotation["type"] = "";
--- a/src/js/widgets/sparklineWidget.js	Mon Jan 16 17:27:23 2012 +0100
+++ b/src/js/widgets/sparklineWidget.js	Tue Jan 17 11:00:33 2012 +0100
@@ -101,7 +101,7 @@
 IriSP.SparklineWidget.prototype.handleNewAnnotation = function(annotation) {
   var num_columns = (this.selector.width()) / IriSP.widgetsDefaults["SparklineWidget"].column_width;
   var duration = +this._serializer.currentMedia().meta["dc:duration"];
-  var time_step = duration / num_columns; /* the time interval between two columns */
+  var time_step = Math.round(duration / num_columns); /* the time interval between two columns */
   var begin = +annotation.begin;
   
   var index = Math.floor(begin / time_step);