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) {
|
function getNextAnnotation(type, direction) {
|
||||||
// type can be 'annotation' or 'result
|
// type can be 'annotation' or 'result'
|
||||||
var annotation,
|
var annotation,
|
||||||
annotations = type == 'annotation' ? self.annotations : self.results,
|
annotations = type == 'annotation' ? self.annotations : self.results,
|
||||||
index,
|
index,
|
||||||
|
@ -984,9 +984,7 @@ Ox.VideoEditor = function(options, self) {
|
||||||
// fixme: why not goToNextPosition()?
|
// fixme: why not goToNextPosition()?
|
||||||
function getNextPosition(type, direction) {
|
function getNextPosition(type, direction) {
|
||||||
// type can be 'annotation', 'cut' or 'result'
|
// type can be 'annotation', 'cut' or 'result'
|
||||||
var found = false,
|
var positions;
|
||||||
position = 0,
|
|
||||||
positions;
|
|
||||||
if (type == 'annotation') {
|
if (type == 'annotation') {
|
||||||
positions = self.positions;
|
positions = self.positions;
|
||||||
} else if (type == 'cut') {
|
} else if (type == 'cut') {
|
||||||
|
@ -996,23 +994,7 @@ Ox.VideoEditor = function(options, self) {
|
||||||
return result['in'];
|
return result['in'];
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
direction == -1 && positions.reverse();
|
return Ox.nextValue(positions, self.options.position, direction);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPositions() {
|
function getPositions() {
|
||||||
|
|
Loading…
Reference in a new issue