mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
move keyManager.js to KeyboardEventService.js
This commit is contained in:
@@ -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();
|
||||
|
@@ -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));
|
||||
};
|
||||
|
||||
})();
|
Reference in New Issue
Block a user