move keyManager.js to KeyboardEventService.js

This commit is contained in:
Vince
2012-09-16 13:19:31 +02:00
parent 95bfc599e8
commit c4084cf9b6
2 changed files with 14 additions and 8 deletions

View File

@@ -69,8 +69,9 @@ $.namespace("pskl");
this.historyService = new pskl.service.HistoryService(frameSheet);
this.historyService.init();
this.keyManager = new pskl.KeyManager();
this.KeyboardEventService = new pskl.service.KeyboardEventService();
this.KeyboardEventService.init();
pskl.NotificationService.init();
this.localStorageService = new pskl.service.LocalStorageService(frameSheet);
this.localStorageService.init();

View File

@@ -1,14 +1,12 @@
(function () {
var ns = $.namespace("pskl");
ns.KeyManager = function () {
$(document.body).keydown($.proxy(this.onKeyUp_, this));
};
ns.KeyboardEventService = function () {};
/**
* @private
*/
ns.KeyManager.prototype.KeyboardActions_ = {
ns.KeyboardEventService.prototype.KeyboardActions_ = {
"ctrl" : {
"z" : Events.UNDO,
@@ -22,7 +20,7 @@
/**
* @private
*/
ns.KeyManager.prototype.CharCodeToKeyCodeMap_ = {
ns.KeyboardEventService.prototype.CharCodeToKeyCodeMap_ = {
90 : "z",
89 : "y",
@@ -34,7 +32,7 @@
/**
* @private
*/
ns.KeyManager.prototype.onKeyUp_ = function(evt) {
ns.KeyboardEventService.prototype.onKeyUp_ = function(evt) {
var isMac = false;
if (navigator.appVersion.indexOf("Mac")!=-1) {
// Welcome in mac world where vowels are consons and meta used instead of ctrl:
@@ -55,5 +53,12 @@
}
}
};
/**
* @public
*/
ns.KeyboardEventService.prototype.init = function() {
$(document.body).keydown($.proxy(this.onKeyUp_, this));
};
})();