video editor: use Ox.nextValue

This commit is contained in:
rlx 2013-07-18 12:56:19 +00:00
parent 8f9473fa92
commit 25930a5d14

View file

@ -960,7 +960,7 @@ Ox.VideoEditor = function(options, self) {
}
function getNextAnnotation(type, direction) {
// type can be 'annotation' or 'result
// type can be 'annotation' or 'result'
var annotation,
annotations = type == 'annotation' ? self.annotations : self.results,
index,
@ -984,9 +984,7 @@ Ox.VideoEditor = function(options, self) {
// fixme: why not goToNextPosition()?
function getNextPosition(type, direction) {
// type can be 'annotation', 'cut' or 'result'
var found = false,
position = 0,
positions;
var positions;
if (type == 'annotation') {
positions = self.positions;
} else if (type == 'cut') {
@ -996,23 +994,7 @@ Ox.VideoEditor = function(options, self) {
return result['in'];
}));
}
direction == -1 && positions.reverse();
Ox.forEach(positions, function(v) {
if (
direction == 1
? v > self.options.position
: v < self.options.position
) {
position = v;
found = true;
return false; // break
}
});
direction == -1 && positions.reverse();
if (!found) {
position = positions[direction == 1 ? 0 : positions.length - 1];
}
return position;
return Ox.nextValue(positions, self.options.position, direction);
}
function getPositions() {