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,7 +69,8 @@ $.namespace("pskl");
|
|||||||
this.historyService = new pskl.service.HistoryService(frameSheet);
|
this.historyService = new pskl.service.HistoryService(frameSheet);
|
||||||
this.historyService.init();
|
this.historyService.init();
|
||||||
|
|
||||||
this.keyManager = new pskl.KeyManager();
|
this.KeyboardEventService = new pskl.service.KeyboardEventService();
|
||||||
|
this.KeyboardEventService.init();
|
||||||
|
|
||||||
pskl.NotificationService.init();
|
pskl.NotificationService.init();
|
||||||
this.localStorageService = new pskl.service.LocalStorageService(frameSheet);
|
this.localStorageService = new pskl.service.LocalStorageService(frameSheet);
|
||||||
|
@@ -1,14 +1,12 @@
|
|||||||
(function () {
|
(function () {
|
||||||
var ns = $.namespace("pskl");
|
var ns = $.namespace("pskl");
|
||||||
|
|
||||||
ns.KeyManager = function () {
|
ns.KeyboardEventService = function () {};
|
||||||
$(document.body).keydown($.proxy(this.onKeyUp_, this));
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ns.KeyManager.prototype.KeyboardActions_ = {
|
ns.KeyboardEventService.prototype.KeyboardActions_ = {
|
||||||
|
|
||||||
"ctrl" : {
|
"ctrl" : {
|
||||||
"z" : Events.UNDO,
|
"z" : Events.UNDO,
|
||||||
@@ -22,7 +20,7 @@
|
|||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ns.KeyManager.prototype.CharCodeToKeyCodeMap_ = {
|
ns.KeyboardEventService.prototype.CharCodeToKeyCodeMap_ = {
|
||||||
|
|
||||||
90 : "z",
|
90 : "z",
|
||||||
89 : "y",
|
89 : "y",
|
||||||
@@ -34,7 +32,7 @@
|
|||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ns.KeyManager.prototype.onKeyUp_ = function(evt) {
|
ns.KeyboardEventService.prototype.onKeyUp_ = function(evt) {
|
||||||
var isMac = false;
|
var isMac = false;
|
||||||
if (navigator.appVersion.indexOf("Mac")!=-1) {
|
if (navigator.appVersion.indexOf("Mac")!=-1) {
|
||||||
// Welcome in mac world where vowels are consons and meta used instead of ctrl:
|
// Welcome in mac world where vowels are consons and meta used instead of ctrl:
|
||||||
@@ -56,4 +54,11 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
ns.KeyboardEventService.prototype.init = function() {
|
||||||
|
$(document.body).keydown($.proxy(this.onKeyUp_, this));
|
||||||
|
};
|
||||||
|
|
||||||
})();
|
})();
|
Reference in New Issue
Block a user