mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-16 22:46:03 +01:00
fix(web/skillcheck) fix cyrillic keyboards not detecting correct inputs (#512)
resolves #410
This commit is contained in:
@@ -21,10 +21,21 @@ const Indicator: React.FC<Props> = ({ angle, offset, multiplier, handleComplete,
|
||||
}),
|
||||
1
|
||||
);
|
||||
|
||||
const keyHandler = useCallback(
|
||||
(e: KeyboardEvent) => {
|
||||
setKeyPressed(e.key.toLowerCase());
|
||||
const capitalHetaCode = 880;
|
||||
const isNonLatin = e.key.charCodeAt(0) >= capitalHetaCode;
|
||||
var convKey = e.key.toLowerCase()
|
||||
if (isNonLatin) {
|
||||
if (e.code.indexOf('Key') === 0 && e.code.length === 4) { // i.e. 'KeyW'
|
||||
convKey = e.code.charAt(3);
|
||||
}
|
||||
|
||||
if (e.code.indexOf('Digit') === 0 && e.code.length === 6) { // i.e. 'Digit7'
|
||||
convKey = e.code.charAt(5);
|
||||
}
|
||||
}
|
||||
setKeyPressed(convKey.toLowerCase());
|
||||
},
|
||||
[skillCheck]
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user