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