mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
"Fix" getStringForKeyCode returning incorrect strings (#753)
* Fix getStringForKeyCode returning wrong result This adds the full stop/period (.) key to the switch statement, and replaces String.fromCharCode (which works with Unicode) with the replacement character (�). * Make letter keys work properly * Add digits and display unknown codes in brackets * better formatting
This commit is contained in:
parent
7517d4a979
commit
0481c84e72
@ -248,6 +248,8 @@ export function getStringForKeyCode(code) {
|
||||
return ",";
|
||||
case 189:
|
||||
return "-";
|
||||
case 190:
|
||||
return ".";
|
||||
case 191:
|
||||
return "/";
|
||||
case 219:
|
||||
@ -260,7 +262,9 @@ export function getStringForKeyCode(code) {
|
||||
return "'";
|
||||
}
|
||||
|
||||
return String.fromCharCode(code);
|
||||
return (48 <= code && code <= 57) || (65 <= code && code <= 90)
|
||||
? String.fromCharCode(code)
|
||||
: "[" + code + "]";
|
||||
}
|
||||
|
||||
export class Keybinding {
|
||||
|
Loading…
Reference in New Issue
Block a user