fix two way mapping of keys
This commit is contained in:
parent
21bd4a15fa
commit
5e2c5f4e0a
3 changed files with 14 additions and 7 deletions
|
|
@ -116,7 +116,7 @@ exports.handler = {
|
||||||
|
|
||||||
handleKeyboard: function(data, hashId, key, keyCode, e) {
|
handleKeyboard: function(data, hashId, key, keyCode, e) {
|
||||||
// ignore command keys (shift, ctrl etc.)
|
// ignore command keys (shift, ctrl etc.)
|
||||||
if (hashId != 0 && (key == "" || key == "\x00"))
|
if (hashId !== 0 && (!key || keyCode == -1))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var editor = data.editor;
|
var editor = data.editor;
|
||||||
|
|
|
||||||
|
|
@ -258,11 +258,11 @@ function normalizeCommandKeys(callback, e, keyCode) {
|
||||||
hashId = 8;
|
hashId = 8;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
keyCode = 0;
|
keyCode = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hashId & 8 && (keyCode === 91 || keyCode === 93)) {
|
if (hashId & 8 && (keyCode === 91 || keyCode === 93)) {
|
||||||
keyCode = 0;
|
keyCode = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hashId && keyCode === 13) {
|
if (!hashId && keyCode === 13) {
|
||||||
|
|
|
||||||
|
|
@ -46,8 +46,8 @@ var Keys = (function() {
|
||||||
},
|
},
|
||||||
|
|
||||||
KEY_MODS: {
|
KEY_MODS: {
|
||||||
"ctrl": 1, "alt": 2, "option" : 2,
|
"ctrl": 1, "alt": 2, "option" : 2, "shift": 4,
|
||||||
"shift": 4, "meta": 8, "command": 8, "cmd": 8
|
"super": 8, "meta": 8, "command": 8, "cmd": 8
|
||||||
},
|
},
|
||||||
|
|
||||||
FUNCTION_KEYS : {
|
FUNCTION_KEYS : {
|
||||||
|
|
@ -108,8 +108,15 @@ var Keys = (function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
// A reverse map of FUNCTION_KEYS
|
// A reverse map of FUNCTION_KEYS
|
||||||
for (var i in ret.FUNCTION_KEYS) {
|
var name, i;
|
||||||
var name = ret.FUNCTION_KEYS[i].toLowerCase();
|
for (i in ret.FUNCTION_KEYS) {
|
||||||
|
name = ret.FUNCTION_KEYS[i].toLowerCase();
|
||||||
|
ret[name] = parseInt(i, 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
// A reverse map of PRINTABLE_KEYS
|
||||||
|
for (i in ret.PRINTABLE_KEYS) {
|
||||||
|
name = ret.PRINTABLE_KEYS[i].toLowerCase();
|
||||||
ret[name] = parseInt(i, 10);
|
ret[name] = parseInt(i, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue