From bbdbaf86dac0e4e4da2b8ec3fe9ac5594e937ca9 Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Sat, 18 Feb 2012 07:22:31 +0000 Subject: [PATCH] keep annotation remove from throwing errors (fixes #452) --- source/Ox.UI/js/Video/Ox.VideoEditor.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/Ox.UI/js/Video/Ox.VideoEditor.js b/source/Ox.UI/js/Video/Ox.VideoEditor.js index 39d0f5a1..0afe848f 100644 --- a/source/Ox.UI/js/Video/Ox.VideoEditor.js +++ b/source/Ox.UI/js/Video/Ox.VideoEditor.js @@ -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) {