1
0
Fork 0
forked from 0x2620/oxjs

splitpanel update (allow for animation, improve performance)

This commit is contained in:
rlx 2011-09-18 21:17:39 +00:00
commit 17d842c64c
7 changed files with 118 additions and 69 deletions

View file

@ -10,6 +10,7 @@ Ox.VideoPreview = function(options, self) {
fps: 25,
frameRatio: 16/9,
height: 256,
scaleToFill: false,
timeline: '',
width: 256
})
@ -59,14 +60,19 @@ Ox.VideoPreview = function(options, self) {
}
function getFrameCSS() {
var height = self.options.height - 16,
width = Math.round(height * self.options.frameRatio),
marginLeft = Math.round((self.options.width - width) / 2);
return {
height: height + 'px',
width: width + 'px',
marginLeft: marginLeft + 'px'
var css = {};
if (!self.options.scaleToFill) {
css.width = self.options.width;
css.height = Math.round(css.width / self.options.frameRatio);
css.marginTop = Math.floor((self.options.height - 16 - css.height) / 2);
} else {
css.height = self.options.height - 16;
css.width = Math.round(css.height * self.options.frameRatio);
css.marginLeft = Math.floor((self.options.width - css.width) / 2);
}
return Ox.map(css, function(value) {
return value + 'px';
});
}
function getPosition(x) {