# HG changeset patch # User hamidouk # Date 1320854783 -3600 # Node ID ec3e6d34462c3dbe13ef8eb1136eeb45ae58c442 # Parent d1e8916272869d0b493641a93a86d0ea0e0f1f45 fixed css positioning bug. diff -r d1e891627286 -r ec3e6d34462c src/js/layout.js --- a/src/js/layout.js Wed Nov 09 14:49:20 2011 +0100 +++ b/src/js/layout.js Wed Nov 09 17:06:23 2011 +0100 @@ -49,8 +49,11 @@ IriSP.LayoutManager.prototype.createDiv = function() { var newDiv = Popcorn.guid(this._div + "_widget_"); - this._widgets.push(newDiv); - this.selector.append("
"); + this.selector.append("
"); + this.positionMarker = this.selector.children(":first"); + this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.positionUpdater)); this.selector.after("
"); // we need to do this because the segments are floated @@ -83,7 +85,7 @@ IriSP.SegmentsWidget.prototype.clickHandler = function(annotation) { var begin = Math.round((+ annotation.begin) / 1000); - this._Popcorn.currentTime(begin) + this._Popcorn.currentTime(begin); }; IriSP.SegmentsWidget.prototype.searchHandler = function(searchString) { @@ -128,7 +130,7 @@ IriSP.SegmentsWidget.prototype.positionUpdater = function() { var duration = this._serializer.currentMedia().meta["dc:duration"] / 1000; var time = this._Popcorn.currentTime(); - var position = IriSP.timeToPourcent(begin, duration); - - this.positionMarker.css("left", position); + var position = ((time / duration) * 100).toFixed(2); + + this.positionMarker.css("left", position + "%"); }; \ No newline at end of file diff -r d1e891627286 -r ec3e6d34462c unittests/tests/segmentsWidget.js --- a/unittests/tests/segmentsWidget.js Wed Nov 09 14:49:20 2011 +0100 +++ b/unittests/tests/segmentsWidget.js Wed Nov 09 17:06:23 2011 +0100 @@ -30,7 +30,8 @@ widget.draw(); equal(IriSP.jQuery("#widget-div").length, 1, "test if the div has been added correctly"); - equal(IriSP.jQuery("#widget-div").children().length, this.ser._data.annotations.length, "test if children have been added correctly"); + // the + 1 is because we have a z-index div to indicate progress in the video. + equal(IriSP.jQuery("#widget-div").children().length, this.ser._data.annotations.length + 1, "test if children have been added correctly"); }); test("test click on a random segment", function() {