diff --git a/js/piskel.js b/js/piskel.js index 4ec3e406..e98b80c7 100644 --- a/js/piskel.js +++ b/js/piskel.js @@ -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(); diff --git a/js/KeyManager.js b/js/service/KeyboardEventService.js similarity index 74% rename from js/KeyManager.js rename to js/service/KeyboardEventService.js index d23ef5ab..dc31e29f 100644 --- a/js/KeyManager.js +++ b/js/service/KeyboardEventService.js @@ -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)); + }; })(); \ No newline at end of file