From 2aaab74b80e8bd0d016474df015d7f5e7fcb2de4 Mon Sep 17 00:00:00 2001 From: Vince Date: Wed, 12 Sep 2012 21:32:18 +0200 Subject: [PATCH] Fix ctrl/meta for macosx shortcuts --- js/KeyManager.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/js/KeyManager.js b/js/KeyManager.js index d0222b38..e6eef300 100644 --- a/js/KeyManager.js +++ b/js/KeyManager.js @@ -2,7 +2,7 @@ var ns = $.namespace("pskl"); ns.KeyManager = function () { - $(document.body).keyup($.proxy(this.onKeyUp_, this)); + $(document.body).keydown($.proxy(this.onKeyUp_, this)); }; // Kind of object that make you want to stop front-end _engineering_: @@ -29,14 +29,13 @@ ns.KeyManager.prototype.onKeyUp_ = function(evt) { - //var isMac = false; - //if (navigator.appVersion.indexOf("Mac")!=-1) { + var isMac = false; + if (navigator.appVersion.indexOf("Mac")!=-1) { // Welcome in mac world where vowels are consons and meta used instead of ctrl: - // isMac = true; - //} - - // (isMac ? evt.metaKey : evt.ctrlKey) { - if (evt.ctrlKey) { + isMac = true; + } + + if (isMac ? evt.metaKey : evt.ctrlKey) { // Get key pressed: var letter = this.CharCodeToKeyCodeMap[evt.which]; if(letter) {