make cycling through matches work, even when matches have the same in/out
This commit is contained in:
parent
1ae47b761b
commit
addd277748
1 changed files with 32 additions and 37 deletions
|
@ -442,14 +442,14 @@ Ox.VideoEditor = function(options, self) {
|
||||||
width: 256
|
width: 256
|
||||||
}).open();
|
}).open();
|
||||||
} else if (id == 'downloadVideo') {
|
} else if (id == 'downloadVideo') {
|
||||||
that.triggerEvent('downloadvideo');
|
that.triggerEvent('downloadVideo');
|
||||||
} else if (id == 'downloadSelection') {
|
} else if (id == 'downloadSelection') {
|
||||||
that.triggerEvent('downloadselection', {
|
that.triggerEvent('downloadSelection', {
|
||||||
'in': self.options['in'],
|
'in': self.options['in'],
|
||||||
out: self.options.out,
|
out: self.options.out,
|
||||||
});
|
});
|
||||||
} else if (id == 'embedSelection') {
|
} else if (id == 'embedSelection') {
|
||||||
that.triggerEvent('embedselection', {
|
that.triggerEvent('embedSelection', {
|
||||||
'in': self.options['in'],
|
'in': self.options['in'],
|
||||||
out: self.options.out,
|
out: self.options.out,
|
||||||
});
|
});
|
||||||
|
@ -547,7 +547,7 @@ Ox.VideoEditor = function(options, self) {
|
||||||
changeOnKeypress: true,
|
changeOnKeypress: true,
|
||||||
placeholder: 'Find...',
|
placeholder: 'Find...',
|
||||||
value: self.options.find,
|
value: self.options.find,
|
||||||
width: 96
|
width: 128
|
||||||
})
|
})
|
||||||
.css({float: 'right', background: 'transparent'})
|
.css({float: 'right', background: 'transparent'})
|
||||||
.bindEvent({
|
.bindEvent({
|
||||||
|
@ -780,22 +780,13 @@ Ox.VideoEditor = function(options, self) {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
} else if (a['in'] > b['in']) {
|
} else if (a['in'] > b['in']) {
|
||||||
ret = 1;
|
ret = 1;
|
||||||
} else if (a.out > b.out) {
|
|
||||||
ret = -1;
|
|
||||||
} else if (a.out < b.out) {
|
} else if (a.out < b.out) {
|
||||||
|
ret = -1;
|
||||||
|
} else if (a.out > b.out) {
|
||||||
ret = 1;
|
ret = 1;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
});
|
});
|
||||||
Ox.print('RESULTS:', results)
|
|
||||||
/*
|
|
||||||
results = Ox.map(self.options.subtitles, function(subtitle) {
|
|
||||||
return subtitle.text.toLowerCase().indexOf(query) > -1 ? {
|
|
||||||
'in': subtitle['in'],
|
|
||||||
out: subtitle.out
|
|
||||||
} : null;
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
@ -890,11 +881,16 @@ Ox.VideoEditor = function(options, self) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNextResult(direction) {
|
function getNextResult(direction) {
|
||||||
var found = false,
|
var found = false, index, result;
|
||||||
result,
|
if (
|
||||||
results = Ox.clone(self.results);
|
self.currentResult
|
||||||
direction == -1 && results.reverse();
|
&& self.options.position == Ox.getObjectById(self.results, self.currentResult)['in']
|
||||||
Ox.forEach(results, function(v) {
|
) {
|
||||||
|
index = Ox.getIndexById(self.results, self.currentResult);
|
||||||
|
result = self.results[Ox.mod(index + direction, self.results.length)];
|
||||||
|
} else {
|
||||||
|
direction == -1 && self.results.reverse();
|
||||||
|
Ox.forEach(self.results, function(v) {
|
||||||
if (
|
if (
|
||||||
direction == 1
|
direction == 1
|
||||||
? v['in'] > self.options.position
|
? v['in'] > self.options.position
|
||||||
|
@ -905,10 +901,13 @@ Ox.VideoEditor = function(options, self) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
direction == -1 && results.reverse();
|
direction == -1 && self.results.reverse();
|
||||||
if (!found) {
|
if (!found) {
|
||||||
result = results[direction == 1 ? 0 : results.length - 1];
|
Ox.print('!found', direction, self.results[direction == 1 ? 0 : results.length - 1])
|
||||||
|
result = self.results[direction == 1 ? 0 : self.results.length - 1];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
self.currentResult = result.id;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1064,7 +1063,6 @@ Ox.VideoEditor = function(options, self) {
|
||||||
// FIXME
|
// FIXME
|
||||||
// self.editing = false;
|
// self.editing = false;
|
||||||
self.options.selected = data.id;
|
self.options.selected = data.id;
|
||||||
Ox.print('SOS???', self.options.selected);
|
|
||||||
if (self.options.selected) {
|
if (self.options.selected) {
|
||||||
self.options.annotationsRange != 'position' && setPosition(data['in']);
|
self.options.annotationsRange != 'position' && setPosition(data['in']);
|
||||||
setPoint('in', data['in'], true);
|
setPoint('in', data['in'], true);
|
||||||
|
@ -1072,9 +1070,7 @@ Ox.VideoEditor = function(options, self) {
|
||||||
}
|
}
|
||||||
self.$annotationPanel.options({selected: self.options.selected});
|
self.$annotationPanel.options({selected: self.options.selected});
|
||||||
setTimelineState();
|
setTimelineState();
|
||||||
that.triggerEvent('select', {
|
that.triggerEvent('select', {id: self.options.selected});
|
||||||
id: self.options.selected
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectCut() {
|
function selectCut() {
|
||||||
|
@ -1227,7 +1223,6 @@ Ox.VideoEditor = function(options, self) {
|
||||||
if (hasPressedEnter) {
|
if (hasPressedEnter) {
|
||||||
that.triggerEvent('find', {find: self.options.find});
|
that.triggerEvent('find', {find: self.options.find});
|
||||||
if (self.results.length) {
|
if (self.results.length) {
|
||||||
Ox.print('HELLO?>??', getNextResult(1))
|
|
||||||
selectAnnotation(getNextResult(1));
|
selectAnnotation(getNextResult(1));
|
||||||
} else {
|
} else {
|
||||||
self.$findInput.focusInput(true);
|
self.$findInput.focusInput(true);
|
||||||
|
|
Loading…
Reference in a new issue