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() { selectnone: function() {
that.triggerEvent('selectnone'); that.triggerEvent('selectnone');
}, },
submit: submitAnnotation, 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');
}
}) })
.appendTo( .appendTo(
['event', 'place'].indexOf(self.options.type) > -1 ['event', 'place'].indexOf(self.options.type) > -1
? self.$outer : that.$content ? 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() { self.options.selected && setTimeout(function() {
// need timeout in order to trigger events // need timeout in order to trigger events
if (self.options.collapsed) { if (self.options.collapsed) {

View file

@ -219,32 +219,18 @@ Ox.AnnotationPanel = function(options, self) {
layer.type == 'event' ? 'calendar' : 'map' layer.type == 'event' ? 'calendar' : 'map'
), data); ), 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); .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( that.setElement(

View file

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