mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-29 17:27:22 +02:00
better keyup stuff
This commit is contained in:
parent
c5615fe15a
commit
3d02036a54
3 changed files with 28 additions and 12 deletions
|
@ -48,15 +48,19 @@ var init = function() {
|
|||
eventBaton.trigger('documentClick', e);
|
||||
});
|
||||
$(document).bind('keydown', function(e) {
|
||||
eventBaton.trigger('keydown', e);
|
||||
eventBaton.trigger('docKeydown', e);
|
||||
});
|
||||
$(document).bind('keyup', function(e) {
|
||||
eventBaton.trigger('keyup', e);
|
||||
eventBaton.trigger('docKeyup', e);
|
||||
});
|
||||
|
||||
$(window).on('resize', function(e) {
|
||||
events.trigger('resize', e);
|
||||
});
|
||||
|
||||
eventBaton.stealBaton('docKeydown', function() { });
|
||||
eventBaton.stealBaton('docKeyup', function() { });
|
||||
|
||||
// zoom level measure, I wish there was a jquery event for this :/
|
||||
require('../util/zoomLevel').setupZoomPoll(function(level) {
|
||||
eventBaton.trigger('zoomChange', level);
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
var _ = require('underscore');
|
||||
var Backbone = require('backbone');
|
||||
|
||||
var Main = require('../app');
|
||||
|
||||
var mapKeycodeToKey = function(keycode) {
|
||||
// HELP WANTED -- internationalize? Dvorak? I have no idea
|
||||
var keyMap = {
|
||||
|
@ -25,11 +27,11 @@ function KeyboardListener(options) {
|
|||
}
|
||||
|
||||
KeyboardListener.prototype.listen = function() {
|
||||
$(document).bind('keydown', this.keydownListener);
|
||||
Main.getEventBaton().stealBaton('docKeydown', this.keydownListener, this);
|
||||
};
|
||||
|
||||
KeyboardListener.prototype.mute = function() {
|
||||
$(document).unbind('keydown', this.keydownListener);
|
||||
Main.getEventBaton().releaseBaton('docKeydown', this.keydownListener, this);
|
||||
};
|
||||
|
||||
KeyboardListener.prototype.keydown = function(e) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue