keep annotation remove from throwing errors (fixes #452)

This commit is contained in:
rlx 2012-02-18 07:22:31 +00:00
parent fe87e6ab1c
commit bbdbaf86da

View file

@ -979,16 +979,18 @@ Ox.VideoEditor = function(options, self) {
} }
function removeAnnotation(data) { function removeAnnotation(data) {
//Ox.print('REMOVE EVENT REACHED EDITOR', data) Ox.print('REMOVE EVENT REACHED EDITOR', data)
var layer = Ox.getObjectById(self.options.layers, data.layer), var layer = Ox.getObjectById(self.options.layers, data.layer),
index = Ox.getIndexById(layer.items, data.id); index = Ox.getIndexById(layer.items, data.id);
// deselect event will have fired before
self.options.selected = data.id;
updateWords('remove'); updateWords('remove');
self.options.selected = '';
layer.items.splice(index, 1); layer.items.splice(index, 1);
self.annotations = getAnnotations(); self.annotations = getAnnotations();
self.positions = getPositions(); self.positions = getPositions();
self.options.find && submitFindInput(self.options.find); self.options.find && submitFindInput(self.options.find);
self.editing = false; self.editing = false;
self.options.selected = '';
setTimelineState(); setTimelineState();
that.triggerEvent('removeannotation', data); that.triggerEvent('removeannotation', data);
} }
@ -1004,6 +1006,7 @@ Ox.VideoEditor = function(options, self) {
} }
function selectAnnotation(data, stayAtPosition) { function selectAnnotation(data, stayAtPosition) {
Ox.print('SELECT ANNOTATION', data);
if (Ox.isUndefined(data)) { if (Ox.isUndefined(data)) {
// doubleclick on small timeline // doubleclick on small timeline
data = getAnnotation(); data = getAnnotation();
@ -1258,6 +1261,7 @@ Ox.VideoEditor = function(options, self) {
function updateWords(action) { function updateWords(action) {
// action can be 'add' or 'remove' // action can be 'add' or 'remove'
var words = []; var words = [];
Ox.print('....', self.options.selected, getAnnotationValue(self.options.selected))
Ox.forEach(Ox.count(Ox.words( Ox.forEach(Ox.count(Ox.words(
getAnnotationValue(self.options.selected) getAnnotationValue(self.options.selected)
)), function(count, value) { )), function(count, value) {