1
0
Fork 0
forked from 0x2620/oxjs

enable timeline types

This commit is contained in:
rlx 2012-06-15 13:20:07 +00:00
commit 856ea3b1d3
7 changed files with 134 additions and 94 deletions

View file

@ -36,6 +36,7 @@ Ox.BlockVideoTimeline = function(options, self) {
results: setResults,
subtitles: setSubtitles,
state: setState,
type: setType,
width: setWidth
})
.addClass('OxBlockVideoTimeline')
@ -69,19 +70,7 @@ Ox.BlockVideoTimeline = function(options, self) {
setCSS();
self.$image = Ox.SmallVideoTimelineImage({
duration: self.options.duration,
editing: self.options.editing,
imageURL: self.options.getImageURL,
'in': self.options['in'],
mode: 'editor',
out: self.options.out,
results: self.options.results,
state: self.options.state,
subtitles: self.options.subtitles,
type: self.options.type,
width: Math.round(self.options.duration)
});
self.$image = getImage();
Ox.loop(self.lines, function(i) {
addLine(i);
@ -155,6 +144,22 @@ Ox.BlockVideoTimeline = function(options, self) {
}
}
function getImage() {
return Ox.SmallVideoTimelineImage({
duration: self.options.duration,
editing: self.options.editing,
imageURL: self.options.getImageURL,
'in': self.options['in'],
mode: 'editor',
out: self.options.out,
results: self.options.results,
state: self.options.state,
subtitles: self.options.subtitles,
type: self.options.type,
width: Math.round(self.options.duration)
});
}
function getLines() {
return Math.ceil(self.options.duration / self.options.width);
}
@ -270,6 +275,19 @@ Ox.BlockVideoTimeline = function(options, self) {
updateTimelines();
}
function setType() {
self.$image = getImage();
self.$images.forEach(function($image, i) {
self.$images[i].replaceWith(
self.$images[i] = self.$image.clone()
.css({
position: 'absolute',
marginLeft: -i * self.options.width + 'px'
})
);
});
}
function setWidth() {
self.lines = getLines();
setCSS();
@ -303,11 +321,10 @@ Ox.BlockVideoTimeline = function(options, self) {
function updateTimelines() {
self.$lines.forEach(function($line, i) {
$($line.children()[0]).replaceWith(
self.$images[i] = self.$image.clone()
.css({
position: 'absolute',
marginLeft: (-i * self.options.width) + 'px'
})
self.$images[i] = self.$image.clone().css({
position: 'absolute',
marginLeft: (-i * self.options.width) + 'px'
})
);
});
}