From 6a9707ed0b086679867db30fe6a3ae36c202ec18 Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Sun, 19 Feb 2012 14:37:55 +0000 Subject: [PATCH] fix a bug where pressing delete would not remove an annotation if the video editor had focus (fixes #477) --- source/Ox.UI/js/Video/Ox.AnnotationFolder.js | 11 ----------- source/Ox.UI/js/Video/Ox.AnnotationPanel.js | 16 +++++++++++----- source/Ox.UI/js/Video/Ox.VideoEditor.js | 3 +++ 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/source/Ox.UI/js/Video/Ox.AnnotationFolder.js b/source/Ox.UI/js/Video/Ox.AnnotationFolder.js index a5c7d532..9c7faa65 100644 --- a/source/Ox.UI/js/Video/Ox.AnnotationFolder.js +++ b/source/Ox.UI/js/Video/Ox.AnnotationFolder.js @@ -614,17 +614,6 @@ Ox.AnnotationFolder = function(options, self) { } }; - /*@ - removeItems removeItems - @*/ - /* - that.removeItem = function(id) { - var pos = Ox.getIndexById(self.options.items, id); - self.options.items.splice(pos, 1); - self.$annotations.removeItems && self.$annotations.removeItems([id]); - }; - */ - that.updateItem = function(id, data) { Ox.print('-- UPDATE ITEM', id, data); var item = Ox.getObjectById(self.options.items, id); diff --git a/source/Ox.UI/js/Video/Ox.AnnotationPanel.js b/source/Ox.UI/js/Video/Ox.AnnotationPanel.js index 37cf77e3..6a215e27 100644 --- a/source/Ox.UI/js/Video/Ox.AnnotationPanel.js +++ b/source/Ox.UI/js/Video/Ox.AnnotationPanel.js @@ -486,11 +486,17 @@ Ox.AnnotationPanel = function(options, self) { renderEditMenu(); }; - that.removeItem = function() { - self.options.selected = ''; - self.users = getUsers(); - renderOptionsMenu(); - renderEditMenu(); + that.removeItem = function(remove) { + if (remove) { + // remove initiated by video editor + getFolder(self.options.selected).removeItem(); + } else { + // called from removeannotation callback + self.options.selected = ''; + self.users = getUsers(); + renderOptionsMenu(); + renderEditMenu(); + } }; that.updateItem = function(id, item) { diff --git a/source/Ox.UI/js/Video/Ox.VideoEditor.js b/source/Ox.UI/js/Video/Ox.VideoEditor.js index 93de2628..e25acfa0 100644 --- a/source/Ox.UI/js/Video/Ox.VideoEditor.js +++ b/source/Ox.UI/js/Video/Ox.VideoEditor.js @@ -83,6 +83,9 @@ Ox.VideoEditor = function(options, self) { key_comma: function() { movePositionTo('cut', -1); }, + key_delete: function() { + self.$annotationPanel.removeItem(true); + }, key_dot: function() { movePositionTo('cut', 1); },