in timeline player, only show vertical scrollbar if needed - should fix #759, but can't be tested locally

This commit is contained in:
rlx 2012-04-19 07:15:35 +00:00
parent 821e8d1a4e
commit 01b4840fd6

View file

@ -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) {