move add annotation entries from options menu to edit menu

This commit is contained in:
rolux 2014-01-17 15:10:02 +00:00
parent e4b0b306b2
commit 70dda8264c

View file

@ -219,6 +219,9 @@ Ox.AnnotationPanel = function(options, self) {
self.$editMenuButton && self.$editMenuButton.remove(); self.$editMenuButton && self.$editMenuButton.remove();
self.$editMenuButton = Ox.MenuButton({ self.$editMenuButton = Ox.MenuButton({
items: [].concat( 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: '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'}, {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'}) .css({float: 'right'})
.bindEvent({ .bindEvent({
click: function(data) { 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(); getFolder(self.options.selected).removeItem();
} else if (data.id == 'deselect') { } else if (data.id == 'deselect') {
getFolder(self.options.selected).options({selected: ''}); getFolder(self.options.selected).options({selected: ''});
@ -397,9 +402,6 @@ Ox.AnnotationPanel = function(options, self) {
self.$optionsMenuButton && self.$optionsMenuButton.remove(); self.$optionsMenuButton && self.$optionsMenuButton.remove();
self.$optionsMenuButton = Ox.MenuButton({ self.$optionsMenuButton = Ox.MenuButton({
items: [].concat( 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}, {id: 'showannotations', title: Ox._('Show Annotations'), disabled: true},
{group: 'range', min: 1, max: 1, items: [ {group: 'range', min: 1, max: 1, items: [
@ -458,9 +460,6 @@ Ox.AnnotationPanel = function(options, self) {
that.triggerEvent('annotations' + data.id, set); that.triggerEvent('annotations' + data.id, set);
} }
}, },
click: function(data) {
that.triggerEvent('add', {layer: data.id, value: ''});
},
hide: function() { hide: function() {
self.options.selected self.options.selected
? getFolder(self.options.selected).gainFocus() ? getFolder(self.options.selected).gainFocus()