pass video editor keyboard events when annotations have focus (fixes #318)

This commit is contained in:
rlx 2012-02-15 22:20:19 +00:00
parent c040e48601
commit 6f3a4d1386
3 changed files with 36 additions and 76 deletions

View file

@ -260,37 +260,24 @@ Ox.AnnotationFolder = function(options, self) {
selectnone: function() {
that.triggerEvent('selectnone');
},
submit: submitAnnotation,
key_b: function() {
that.triggerEvent('key_b');
},
key_equal: function() {
that.triggerEvent('key_equal');
},
key_f: function() {
that.triggerEvent('key_f');
},
key_g: function() {
that.triggerEvent('key_g');
},
key_minus: function() {
that.triggerEvent('key_minus');
},
key_n: function() {
that.triggerEvent('key_n');
},
key_shift_g: function() {
that.triggerEvent('key_shift_g');
},
key_space: function() {
that.triggerEvent('key_space');
}
submit: submitAnnotation
})
.appendTo(
['event', 'place'].indexOf(self.options.type) > -1
? self.$outer : that.$content
);
[
'0', 'b', 'backslash', 'closebracket', 'comma', 'dot', 'equal',
'f', 'g', 'h', 'i', 'minus', 'n', 'o', 'openbracket', 'p',
'shift_0', 'shift_g', 'shift_i', 'shift_o', 'slash', 'space'
].forEach(function(key) {
key = 'key_' + key;
self.$annotations.bindEvent(key, function() {
that.triggerEvent(key);
});
});
self.options.selected && setTimeout(function() {
// need timeout in order to trigger events
if (self.options.collapsed) {

View file

@ -219,32 +219,18 @@ Ox.AnnotationPanel = function(options, self) {
layer.type == 'event' ? 'calendar' : 'map'
), data);
},
key_b: function() {
that.triggerEvent('key_b');
},
key_equal: function() {
that.triggerEvent('key_equal');
},
key_f: function() {
that.triggerEvent('key_f');
},
key_g: function() {
that.triggerEvent('key_g');
},
key_minus: function() {
that.triggerEvent('key_minus');
},
key_n: function() {
that.triggerEvent('key_n');
},
key_shift_g: function() {
that.triggerEvent('key_shift_g');
},
key_space: function() {
that.triggerEvent('key_space');
}
})
.appendTo(self.$folders);
[
'0', 'b', 'backslash', 'closebracket', 'comma', 'dot', 'equal',
'f', 'g', 'h', 'i', 'minus', 'n', 'o', 'openbracket', 'p',
'shift_0', 'shift_g', 'shift_i', 'shift_o', 'slash', 'space'
].forEach(function(key) {
key = 'key_' + key;
self.$folder[i].bindEvent(key, function() {
that.triggerEvent(key);
});
});
});
that.setElement(

View file

@ -62,9 +62,6 @@ Ox.VideoEditor = function(options, self) {
.options(options || {})
.bindEvent({
key_0: toggleMuted,
key_shift_0: function() {
movePositionBy(-self.options.position);
},
key_alt_left: function() {
},
key_alt_right: function() {
@ -140,6 +137,9 @@ Ox.VideoEditor = function(options, self) {
key_right: function() {
movePositionBy(0.04);
},
key_shift_0: function() {
movePositionBy(-self.options.position);
},
key_shift_down: function() {
movePositionBy(self.options.duration);
},
@ -648,30 +648,17 @@ Ox.VideoEditor = function(options, self) {
self.options.showAnnotationsMap = !data.collapsed;
that.triggerEvent('togglemap', data);
},
key_b: function() {
that.triggerEvent('key_b');
},
key_equal: function() {
that.triggerEvent('key_equal');
},
key_f: function() {
that.triggerEvent('key_f');
},
key_g: function() {
that.triggerEvent('key_g');
},
key_minus: function() {
that.triggerEvent('key_minus');
},
key_n: function() {
that.triggerEvent('key_n');
},
key_shift_g: function() {
that.triggerEvent('key_shift_g');
},
key_space: function() {
that.triggerEvent('key_space');
}
});
[
'0', 'b', 'backslash', 'closebracket', 'comma', 'dot', 'equal',
'f', 'g', 'h', 'i', 'minus', 'n', 'o', 'openbracket', 'p',
'shift_0', 'shift_g', 'shift_i', 'shift_o', 'slash', 'space'
].forEach(function(key) {
key = 'key_' + key;
self.$annotationPanel.bindEvent(key, function() {
that.triggerEvent(key);
});
});
that.setElement(