From 01b4840fd667f4a0be5b2091d06de21f750975d1 Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Thu, 19 Apr 2012 07:15:35 +0000 Subject: [PATCH] in timeline player, only show vertical scrollbar if needed - should fix #759, but can't be tested locally --- source/Ox.UI/js/Video/Ox.VideoTimelinePlayer.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/source/Ox.UI/js/Video/Ox.VideoTimelinePlayer.js b/source/Ox.UI/js/Video/Ox.VideoTimelinePlayer.js index 58634735..31a8a31d 100644 --- a/source/Ox.UI/js/Video/Ox.VideoTimelinePlayer.js +++ b/source/Ox.UI/js/Video/Ox.VideoTimelinePlayer.js @@ -39,7 +39,7 @@ Ox.VideoTimelinePlayer = function(options, self) { self.tileWidth = 1500; self.tileHeight = 64; self.margin = 8; - self.contentWidth = self.options.width - 2 * self.margin - Ox.UI.SCROLLBAR_SIZE; + self.contentWidth = self.options.width - 2 * self.margin; self.contentHeight = self.options.height - 32; self.positionWidth = 48 + !!self.options.showMilliseconds * 2 @@ -96,7 +96,7 @@ Ox.VideoTimelinePlayer = function(options, self) { .appendTo(self.$menubar); self.$timelinePlayer = Ox.Element() - .css({overflowX: 'hidden', overflowY: 'scroll'}) + .css({overflowX: 'hidden', overflowY: 'auto'}) .bind({ mousedown: mousedown, mouseleave: mouseleave, @@ -376,8 +376,17 @@ Ox.VideoTimelinePlayer = function(options, self) { return Ox.formatDuration(position, self.options.showMilliseconds); } - function getLines() { - return Math.ceil((self.frames - 1 + self.videoWidth) / self.contentWidth) + function getLines(scrollbarIsVisible) { + var lines; + if (scrollbarIsVisible) { + self.contentWidth -= Ox.UI.SCROLLBAR_SIZE; + } + lines = Math.ceil( + (self.frames - 1 + self.videoWidth) / self.contentWidth + ); + return !scrollbarIsVisible && lines * ( + self.tileHeight + self.margin + ) + self.margin > self.options.height ? getLines(true) : lines; } function getPosition(e) {