diff --git a/source/Ox.UI/js/Video/SmallVideoTimeline.js b/source/Ox.UI/js/Video/SmallVideoTimeline.js index ecd3be9e..bd57a182 100644 --- a/source/Ox.UI/js/Video/SmallVideoTimeline.js +++ b/source/Ox.UI/js/Video/SmallVideoTimeline.js @@ -14,7 +14,7 @@ Ox.SmallVideoTimeline = function(options, self) { .defaults({ // _offset is a hack for cases where all these position: absolute // elements have to go into a float: left - // FIXME: possible unused and unneeded + // FIXME: possibly unused and unneeded _offset: 0, disabled: false, duration: 0, @@ -26,6 +26,7 @@ Ox.SmallVideoTimeline = function(options, self) { out: 0, paused: false, results: [], + showInToOut: false, showMilliseconds: 0, state: 'default', subtitles: [], @@ -143,12 +144,24 @@ Ox.SmallVideoTimeline = function(options, self) { }); } + function getLeft() { + return ( + self.options.showInToOut + ? self.options.position - self.options['in'] + : self.options.position + ) * self.imageWidth / self.options.duration; + } + function getPosition(e) { var position = ( (e.offsetX ? e.offsetX : e.clientX - $(e.target).offset().left) - (self.options.mode == 'player' ? 8 : 0) ) * self.options.duration / self.imageWidth; - return Ox.limit(position, 0, self.options.duration); + position = Ox.limit(position, 0, self.options.duration); + if (self.options.showInToOut) { + position += self.options['in']; + } + return position; } function getSubtitle(position) { @@ -171,6 +184,7 @@ Ox.SmallVideoTimeline = function(options, self) { mode: self.options.mode, out: self.options.out, results: self.options.results, + showInToOut: self.options.showInToOut, subtitles: self.options.subtitles, state: self.options.state, type: self.options.type, @@ -215,17 +229,15 @@ Ox.SmallVideoTimeline = function(options, self) { function setPointMarker(point) { self.$pointMarker[point].css({ - left: self.imageLeft + Math.round( - self.options[point] * self.imageWidth / self.options.duration - ) + 'px' + left: self.imageLeft + Math.round(getLeft()) + 'px' }); } function setPositionMarker() { self.$positionMarker.css({ - left: self.interfaceLeft + Math.round( - self.options.position * self.imageWidth / self.options.duration - ) - (self.options.mode == 'editor' ? 5 : 0) + self.options._offset + 'px' + left: self.interfaceLeft + Math.round(getLeft()) + - (self.options.mode == 'editor' ? 5 : 0) + + self.options._offset + 'px' }); }