1
0
Fork 0
forked from 0x2620/oxjs

make cursor keys work across annotation folders; make clicking in string annotation folder deselect annotation in other folder

This commit is contained in:
rlx 2012-02-01 19:33:10 +00:00
commit 1eaf240970
3 changed files with 73 additions and 8 deletions

View file

@ -204,6 +204,13 @@ Ox.AnnotationPanel = function(options, self) {
select: function(data) {
selectAnnotation(data, i);
},
selectafter: function() {
selectNext(layer.id, 1);
},
selectbefore: function() {
selectNext(layer.id, -1);
},
selectnone: selectNone,
submit: function(data) {
that.triggerEvent('submit', Ox.extend({layer: layer.id}, data));
},
@ -303,6 +310,21 @@ Ox.AnnotationPanel = function(options, self) {
that.triggerEvent('select', data);
}
function selectNone() {
if (self.options.selected) {
getFolder(self.options.selected).options({selected: ''});
}
}
function selectNext(layer, direction) {
var index = Ox.mod(
Ox.getIndexById(self.options.layers, layer) + direction,
self.options.layers.length
);
Ox.print('index', index)
self.$folder[index].selectItem(direction == 1 ? 0 : -1);
}
function updateEditMenu() {
var action = self.options.selected ? 'enableItem' : 'disableItem';
self.$editMenuButton[action]('edit');