253
this._keyCodeToLabel[keyCode] = String.fromCharCode(CharCode.A + (charCode - CharCode.a));
254
}
256
>
else if (charCode >= CharCode.A && charCode <= CharCode.Z) {
257
producesLetter[charCode] = true;
258
producesLetters = true;
259
this._keyCodeToLabel[keyCode] = value;
260
}
262
>
else {
263
>
this._keyCodeToLabel[keyCode] = value;
264
>
}
265
>
}
266
>
}
267
>
}
268
>
269
>
// Handle keyboard layouts where latin characters are not produced e.g. Cyrillic
270
>
const _registerLetterIfMissing = (charCode: CharCode, keyCode: KeyCode): void => {
271
>
if (!producesLetter[charCode]) {
272
this._keyCodeToLabel[keyCode] = String.fromCharCode(charCode);
273
}
275
>
_registerLetterIfMissing(CharCode.A, KeyCode.KeyA);
276
>
_registerLetterIfMissing(CharCode.B, KeyCode.KeyB);
277
>
_registerLetterIfMissing(CharCode.C, KeyCode.KeyC);
278
>
_registerLetterIfMissing(CharCode.D, KeyCode.KeyD);
279
>
_registerLetterIfMissing(CharCode.E, KeyCode.KeyE);
280
>
_registerLetterIfMissing(CharCode.F, KeyCode.KeyF);
281
>
_registerLetterIfMissing(CharCode.G, KeyCode.KeyG);
282
>
_registerLetterIfMissing(CharCode.H, KeyCode.KeyH);
283
>
_registerLetterIfMissing(CharCode.I, KeyCode.KeyI);
284
>
_registerLetterIfMissing(CharCode.J, KeyCode.KeyJ);
285
>
_registerLetterIfMissing(CharCode.K, KeyCode.KeyK);
286
>
_registerLetterIfMissing(CharCode.L, KeyCode.KeyL);
287
>
_registerLetterIfMissing(CharCode.M, KeyCode.KeyM);
288
>
_registerLetterIfMissing(CharCode.N, KeyCode.KeyN);
289
>
_registerLetterIfMissing(CharCode.O, KeyCode.KeyO);
290
>
_registerLetterIfMissing(CharCode.P, KeyCode.KeyP);
291
>
_registerLetterIfMissing(CharCode.Q, KeyCode.KeyQ);
292
>
_registerLetterIfMissing(CharCode.R, KeyCode.KeyR);
293
>
_registerLetterIfMissing(CharCode.S, KeyCode.KeyS);
294
>
_registerLetterIfMissing(CharCode.T, KeyCode.KeyT);
295
>
_registerLetterIfMissing(CharCode.U, KeyCode.KeyU);
296
>
_registerLetterIfMissing(CharCode.V, KeyCode.KeyV);
297
>
_registerLetterIfMissing(CharCode.W, KeyCode.KeyW);
298
>
_registerLetterIfMissing(CharCode.X, KeyCode.KeyX);
299
>
_registerLetterIfMissing(CharCode.Y, KeyCode.KeyY);
300
>
_registerLetterIfMissing(CharCode.Z, KeyCode.KeyZ);
301
>
302
>
if (!producesLetters) {
303
// Since this keyboard layout produces no latin letters at all, most of the UI will use the
304
// US kb layout equivalent for UI labels, so also try to render other keys with the US labels