only display add annotation keyboard shortcuts for editable layers

This commit is contained in:
rlx 2012-02-05 10:36:04 +00:00
parent 63a6bf2cb8
commit ed150f21f5

View file

@ -117,7 +117,6 @@ Ox.VideoEditor = function(options, self) {
key_g: function() { key_g: function() {
self.results.length && selectAnnotation(getNextAnnotation('result', 1)); self.results.length && selectAnnotation(getNextAnnotation('result', 1));
}, },
key_h: showKeyboardShortcuts,
key_i: function() { key_i: function() {
setPoint('in', self.options.position); setPoint('in', self.options.position);
}, },
@ -398,8 +397,10 @@ Ox.VideoEditor = function(options, self) {
{key: 'G', action: 'Go to Next Result'}, {key: 'G', action: 'Go to Next Result'},
{key: Ox.UI.symbols['return'], action: 'Edit/Submit'}, {key: Ox.UI.symbols['return'], action: 'Edit/Submit'},
{key: Ox.UI.symbols.escape, action: 'Cancel/Deselect'} {key: Ox.UI.symbols.escape, action: 'Cancel/Deselect'}
], self.options.layers.map(function(layer, i) { ], Ox.map(self.options.layers, function(layer, i) {
return {key: i + 1, action: 'Add ' + layer.item}; return layer.editable
? {key: i + 1, action: 'Add ' + layer.item}
: null;
})).forEach(function(shortcut) { })).forEach(function(shortcut) {
self.$keyboardShortcuts.append( self.$keyboardShortcuts.append(
$('<div>').css({display: 'table-row'}) $('<div>').css({display: 'table-row'})
@ -452,7 +453,17 @@ Ox.VideoEditor = function(options, self) {
click: function(data) { click: function(data) {
var id = data.id; var id = data.id;
if (id == 'keyboard') { if (id == 'keyboard') {
showKeyboardShortcuts(); var dialog = Ox.Dialog({
buttons: [
Ox.Button({id: 'close', title: 'Close'})
.bindEvent({click: function() { dialog.close(); }})
],
content: self.$keyboardShortcuts,
height: 384,
keys: {enter: 'close', escape: 'close'},
title: 'Keyboard Shortcuts',
width: 256
}).open();
} else if (id == 'downloadVideo') { } else if (id == 'downloadVideo') {
that.triggerEvent('downloadvideo'); that.triggerEvent('downloadvideo');
} else if (id == 'downloadSelection') { } else if (id == 'downloadSelection') {
@ -1092,20 +1103,6 @@ Ox.VideoEditor = function(options, self) {
}); });
} }
function showKeyboardShortcuts() {
var dialog = Ox.Dialog({
buttons: [
Ox.Button({id: 'close', title: 'Close'})
.bindEvent({click: function() { dialog.close(); }})
],
content: self.$keyboardShortcuts,
height: 384,
keys: {enter: 'close', escape: 'close'},
title: 'Keyboard Shortcuts',
width: 256
}).open();
}
function setTimelineState() { function setTimelineState() {
self.$timeline[1].options({ self.$timeline[1].options({
state: self.editing ? 'editing' state: self.editing ? 'editing'