From 70dda8264c47363274da4e63609f3b2d21bb69fe Mon Sep 17 00:00:00 2001 From: rolux Date: Fri, 17 Jan 2014 15:10:02 +0000 Subject: [PATCH] move add annotation entries from options menu to edit menu --- source/Ox.UI/js/Video/AnnotationPanel.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/source/Ox.UI/js/Video/AnnotationPanel.js b/source/Ox.UI/js/Video/AnnotationPanel.js index b0217742..14441a53 100644 --- a/source/Ox.UI/js/Video/AnnotationPanel.js +++ b/source/Ox.UI/js/Video/AnnotationPanel.js @@ -219,6 +219,9 @@ Ox.AnnotationPanel = function(options, self) { self.$editMenuButton && self.$editMenuButton.remove(); self.$editMenuButton = Ox.MenuButton({ items: [].concat( + self.options.editable ? self.options.layers.map(function(layer, i) { + return {id: 'add' + layer.id, title: Ox._('Add {0}', [layer.item]), keyboard: i + 1 + ''} + }).concat({}) : [], [ {id: 'deselect', title: Ox._('Deselect Annotation'), disabled: !self.options.selected || self.editing, keyboard: 'escape'}, {id: 'edit', title: Ox._('Edit Annotation'), disabled: !self.options.selected || !isEditable || self.editing, keyboard: 'return'}, @@ -249,7 +252,9 @@ Ox.AnnotationPanel = function(options, self) { .css({float: 'right'}) .bindEvent({ click: function(data) { - if (data.id == 'delete') { + if (Ox.startsWith(data.id, 'add')) { + that.triggerEvent('add', {layer: data.id.slice(3), value: ''}); + } else if (data.id == 'delete') { getFolder(self.options.selected).removeItem(); } else if (data.id == 'deselect') { getFolder(self.options.selected).options({selected: ''}); @@ -397,9 +402,6 @@ Ox.AnnotationPanel = function(options, self) { self.$optionsMenuButton && self.$optionsMenuButton.remove(); self.$optionsMenuButton = Ox.MenuButton({ items: [].concat( - self.options.editable ? self.options.layers.map(function(layer) { - return {id: layer.id, title: Ox._('Add {0}', [layer.item])} - }).concat({}) : [], [ {id: 'showannotations', title: Ox._('Show Annotations'), disabled: true}, {group: 'range', min: 1, max: 1, items: [ @@ -458,9 +460,6 @@ Ox.AnnotationPanel = function(options, self) { that.triggerEvent('annotations' + data.id, set); } }, - click: function(data) { - that.triggerEvent('add', {layer: data.id, value: ''}); - }, hide: function() { self.options.selected ? getFolder(self.options.selected).gainFocus()