From f1120a825b5cbcc97b6faa63d0edb05f0c241cc5 Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Thu, 18 Sep 2014 16:43:00 +0200 Subject: [PATCH] allow for retrieving currently shown annotations from video annotation panel --- source/Ox.UI/js/Video/AnnotationFolder.js | 8 +++++++- source/Ox.UI/js/Video/AnnotationPanel.js | 13 ++++++++++++- source/Ox.UI/js/Video/VideoAnnotationPanel.js | 4 ++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/source/Ox.UI/js/Video/AnnotationFolder.js b/source/Ox.UI/js/Video/AnnotationFolder.js index 16bb024b..a4338dff 100644 --- a/source/Ox.UI/js/Video/AnnotationFolder.js +++ b/source/Ox.UI/js/Video/AnnotationFolder.js @@ -106,7 +106,9 @@ Ox.AnnotationFolder = function(options, self) { self.$widget.options({width: self.options.width}); } self.$annotations.options({ - width: self.options.type == 'text' ? self.options.width + 8 : self.options.width + width: self.options.type == 'text' + ? self.options.width + 8 + : self.options.width }); } }); @@ -646,6 +648,10 @@ Ox.AnnotationFolder = function(options, self) { return that; }; + that.getCurrentAnnotations = function() { + return getAnnotations(); + }; + /*@ removeItem remove item () -> remove selected item diff --git a/source/Ox.UI/js/Video/AnnotationPanel.js b/source/Ox.UI/js/Video/AnnotationPanel.js index 94fca84a..6e78ad16 100644 --- a/source/Ox.UI/js/Video/AnnotationPanel.js +++ b/source/Ox.UI/js/Video/AnnotationPanel.js @@ -493,7 +493,8 @@ Ox.AnnotationPanel = function(options, self) { $folder.options({users: self.enabledUsers}); }); } else { - set[data.id] = data.checked[0].id; + self.options[data.id] = data.checked[0].id; + set[data.id] = self.options[data.id]; self.$folder.forEach(function($folder) { $folder.options(set); }); @@ -646,6 +647,16 @@ Ox.AnnotationPanel = function(options, self) { return that; }; + that.getCurrentAnnotations = function() { + var annotations = {}; + self.options.layers.forEach(function(layer) { + annotations[layer.id] = self.$folder[ + Ox.getIndexById(self.options.layers, layer.id) + ].getCurrentAnnotations(); + }); + return annotations; + }; + /*@ removeItem Remove selected item () -> AnnotationPanel diff --git a/source/Ox.UI/js/Video/VideoAnnotationPanel.js b/source/Ox.UI/js/Video/VideoAnnotationPanel.js index db5f6070..7b794396 100644 --- a/source/Ox.UI/js/Video/VideoAnnotationPanel.js +++ b/source/Ox.UI/js/Video/VideoAnnotationPanel.js @@ -1632,6 +1632,10 @@ Ox.VideoAnnotationPanel = function(options, self) { self.$annotationPanel.addItem(layer, annotation); }; + that.getCurrentAnnotations = function() { + return self.$annotationPanel.getCurrentAnnotations(); + }; + /*@ updateAnnotation updateAnnotation (id, annotation) -> update annotation with id