add option to find selected annotation in _this_ video; make sure focus returns after hiding menus
This commit is contained in:
parent
2bd8c8d13f
commit
73bd672b15
3 changed files with 50 additions and 18 deletions
|
@ -578,6 +578,11 @@ Ox.AnnotationFolder = function(options, self) {
|
|||
return that;
|
||||
};
|
||||
|
||||
that.gainFocus = function() {
|
||||
self.$annotations.gainFocus();
|
||||
return that;
|
||||
};
|
||||
|
||||
that.removeItem = function() {
|
||||
self.$annotations.removeItem();
|
||||
};
|
||||
|
|
|
@ -106,8 +106,11 @@ Ox.AnnotationPanel = function(options, self) {
|
|||
});
|
||||
that.triggerEvent('annotations' + data.id, set);
|
||||
}
|
||||
// FIXME: this does not work
|
||||
self.options.selected && getFolder(self.options.selected).gainFocus();
|
||||
},
|
||||
hide: function() {
|
||||
self.options.selected
|
||||
? getFolder(self.options.selected).gainFocus()
|
||||
: that.triggerEvent('focus');
|
||||
}
|
||||
})
|
||||
.appendTo(self.$menubar);
|
||||
|
@ -257,7 +260,7 @@ Ox.AnnotationPanel = function(options, self) {
|
|||
|
||||
function renderEditMenu() {
|
||||
Ox.print('RENDER EDIT MENU')
|
||||
var annotation, findTitle, folder,
|
||||
var annotation, annotationTitle, folder,
|
||||
isDefined, isEditable, isEvent, isEventOrPlace, isPlace, isString,
|
||||
key, manageTitle, type, value
|
||||
if (self.options.selected) {
|
||||
|
@ -273,24 +276,33 @@ Ox.AnnotationPanel = function(options, self) {
|
|||
isString = type != 'text';
|
||||
// fixme: absence of annotation[type] may be an error
|
||||
isDefined = isEventOrPlace && !!annotation[type] && !!annotation[type].type;
|
||||
annotationTitle = folder.options('item') + ': "' + value + '"';
|
||||
}
|
||||
findTitle = 'Find ' + (isString ? '"' + value + '"' : 'Annotation');
|
||||
manageTitle = (isDefined ? 'Edit' : 'Define') + ' '
|
||||
+ (isPlace ? 'Place' : isEvent ? 'Event' : 'Place or Event') + '...'
|
||||
self.$editMenuButton && self.$editMenuButton.remove();
|
||||
self.$editMenuButton = Ox.MenuButton({
|
||||
items: [
|
||||
{id: 'deselect', title: 'Deselect Annotation', disabled: !self.options.selected || self.editing, keyboard: 'escape'},
|
||||
{id: 'edit', title: 'Edit Annotation', disabled: !self.options.selected || !isEditable || self.editing, keyboard: 'return'},
|
||||
{id: 'delete', title: 'Delete Annotation', disabled: !self.options.selected || !isEditable, keyboard: 'delete'},
|
||||
{},
|
||||
{id: 'insert', title: 'Insert...', disabled: isString || !self.editing},
|
||||
{id: 'undo', title: 'Undo Changes', disabled: !self.editing, keyboard: 'escape'},
|
||||
{id: 'save', title: 'Save Changes', disabled: !self.editing, keyboard: isString ? 'return' : 'shift return'},
|
||||
{},
|
||||
{id: 'manage', title: manageTitle, disabled: !self.options.selected || !isEventOrPlace},
|
||||
{id: 'find', title: findTitle, disabled: !self.options.selected || !isString}
|
||||
],
|
||||
items: Ox.merge(
|
||||
[
|
||||
{id: 'deselect', title: 'Deselect Annotation', disabled: !self.options.selected || self.editing, keyboard: 'escape'},
|
||||
{id: 'edit', title: 'Edit Annotation', disabled: !self.options.selected || !isEditable || self.editing, keyboard: 'return'},
|
||||
{id: 'delete', title: 'Delete Annotation', disabled: !self.options.selected || !isEditable, keyboard: 'delete'},
|
||||
{},
|
||||
{id: 'insert', title: 'Insert...', disabled: isString || !self.editing},
|
||||
{id: 'undo', title: 'Undo Changes', disabled: !self.editing, keyboard: 'escape'},
|
||||
{id: 'save', title: 'Save Changes', disabled: !self.editing, keyboard: isString ? 'return' : 'shift return'},
|
||||
],
|
||||
pandora.site.map == 'manual' ? [
|
||||
{},
|
||||
{id: 'manage', title: manageTitle, disabled: !self.options.selected || !isEventOrPlace},
|
||||
] : [],
|
||||
isString ? [
|
||||
{},
|
||||
{id: 'annotation', title: annotationTitle, disabled: true},
|
||||
{id: 'find', title: 'Find in This ' + pandora.site.itemName.singular},
|
||||
{id: 'findannotations', title: 'Find in All ' + pandora.site.itemName.plural}
|
||||
] : []
|
||||
),
|
||||
maxWidth: 256,
|
||||
style: 'square',
|
||||
title: 'edit',
|
||||
|
@ -307,7 +319,9 @@ Ox.AnnotationPanel = function(options, self) {
|
|||
} else if (data.id == 'edit') {
|
||||
getFolder(self.options.selected).editItem();
|
||||
} else if (data.id == 'find') {
|
||||
that.triggerEvent('find', {key: key, value: value});
|
||||
that.triggerEvent('find', {value: value});
|
||||
} else if (data.id == 'findannotations') {
|
||||
that.triggerEvent('findannotations', {key: key, value: value});
|
||||
} else if (data.id == 'manage') {
|
||||
that.triggerEvent('define', {
|
||||
id: self.options.selected,
|
||||
|
@ -318,6 +332,11 @@ Ox.AnnotationPanel = function(options, self) {
|
|||
} else if (data.id == 'undo') {
|
||||
// ...
|
||||
}
|
||||
},
|
||||
hide: function() {
|
||||
self.options.selected
|
||||
? getFolder(self.options.selected).gainFocus()
|
||||
: that.triggerEvent('focus');
|
||||
}
|
||||
})
|
||||
.appendTo(self.$menubar);
|
||||
|
|
|
@ -484,6 +484,9 @@ Ox.VideoEditor = function(options, self) {
|
|||
} else if (id == 'size') {
|
||||
toggleSize();
|
||||
}
|
||||
},
|
||||
hide: function() {
|
||||
that.gainFocus();
|
||||
}
|
||||
})
|
||||
.appendTo(self.$menubar);
|
||||
|
@ -622,8 +625,13 @@ Ox.VideoEditor = function(options, self) {
|
|||
setTimelineState();
|
||||
},
|
||||
find: function(data) {
|
||||
that.triggerEvent('findannotation', data);
|
||||
self.$findInput.options({value: data.value});
|
||||
submitFindInput(data.value, true);
|
||||
},
|
||||
findannotations: function(data) {
|
||||
that.triggerEvent('findannotations', data);
|
||||
},
|
||||
focus: that.gainFocus,
|
||||
info: function(data) {
|
||||
that.triggerEvent('info', data);
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue