From cbcfbe834089c29a8f1634e775bfe4e9dce9c17e Mon Sep 17 00:00:00 2001 From: rolux Date: Mon, 20 Apr 2015 09:43:01 +0200 Subject: [PATCH] animate subtitles on toggle scale --- source/UI/js/Video/VideoPlayer.js | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/source/UI/js/Video/VideoPlayer.js b/source/UI/js/Video/VideoPlayer.js index 6ef55545..ae203544 100644 --- a/source/UI/js/Video/VideoPlayer.js +++ b/source/UI/js/Video/VideoPlayer.js @@ -1509,7 +1509,19 @@ Ox.VideoPlayer = function(options, self) { marginLeft: -self.timelineImageWidth + 'px' }; } else if (element == 'subtitle') { - css = getSubtitlesCSS(); + css = { + bottom: ( + Math.floor(self.height / 16) + + Math.floor( + self.options.subtitlesOffset / 100 * self.height + ) + + (self.options.subtitlesOffset ? getVideoCSS().top : 0) + + !!self.controlsBottomAreVisible * 16 + ) + 'px', + width: self.width + 'px', + fontSize: Math.floor(self.height / 20) + 'px', + WebkitTextStroke: (self.height / 1000) + 'px rgb(0, 0, 0)' + }; } else if (element == 'spaceBottom' || element == 'timeline') { css = { width: self.timelineWidth + 'px' @@ -1631,20 +1643,6 @@ Ox.VideoPlayer = function(options, self) { : []; } - function getSubtitlesCSS() { - return { - bottom: ( - Math.floor(self.height / 16) - + Math.floor(self.options.subtitlesOffset / 100 * self.height) - + (self.options.subtitlesOffset ? getVideoCSS().top : 0) - + !!self.controlsBottomAreVisible * 16 - ) + 'px', - width: self.width + 'px', - fontSize: Math.floor(self.height / 20) + 'px', - WebkitTextStroke: (self.height / 1000) + 'px rgb(0, 0, 0)' - }; - } - function getTimeline() { var $timeline = Ox.SmallVideoTimeline({ //_offset: getTimelineLeft(), @@ -2692,6 +2690,9 @@ Ox.VideoPlayer = function(options, self) { self.videoCSS = getVideoCSS(); self.$video.animate(self.videoCSS, 250); self.$poster && self.$poster.animate(self.videoCSS, 250); + self.$subtitle && self.$subtitle.animate({ + bottom: getCSS('subtitle').bottom + }, 250); if (self.$scaleButton && from != 'button') { self.$scaleButton.toggle(); }