video editor: use Ox.nextValue
This commit is contained in:
parent
8f9473fa92
commit
25930a5d14
1 changed files with 3 additions and 21 deletions
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue