video editor improvements

This commit is contained in:
rolux 2011-05-18 20:30:58 +02:00
commit a1deb20f97
8 changed files with 89 additions and 50 deletions

View file

@ -51,7 +51,7 @@ Ox.BlockVideoTimeline = function(options, self) {
results: self.options.results,
subtitles: self.options.subtitles,
timeline: self.options.getImageURL,
width: Math.ceil(self.options.duration),
width: Math.round(self.options.duration),
type: self.options.type
});
@ -113,7 +113,7 @@ Ox.BlockVideoTimeline = function(options, self) {
.css({
position: 'absolute',
top: '2px',
width: Math.ceil(self.options.duration) + 'px',
width: Math.round(self.options.duration) + 'px',
height: '20px',
marginLeft: (-i * self.options.width) + 'px',
//background: 'rgba(255, 0, 0, 0.1)',
@ -195,6 +195,20 @@ Ox.BlockVideoTimeline = function(options, self) {
});
}
function setPoint(point) {
setPointMarker(point);
self.$image.options(point, self.options[point]);
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'
})
);
});
}
function setPointMarker(point) {
var position = Math.round(self.options[point]);
self.$pointMarker[point].css({
@ -241,7 +255,9 @@ Ox.BlockVideoTimeline = function(options, self) {
}
self.setOption = function(key, value) {
if (key == 'position') {
if (key == 'in' || key == 'out') {
setPoint(key)
} else if (key == 'position') {
setPositionMarker();
} else if (key == 'width') {
setWidth();