fix value error

This commit is contained in:
Allan Niles 2023-09-12 15:37:57 +00:00
parent e5c7e27526
commit eaac8e0992
2 changed files with 7 additions and 6 deletions

View file

@ -2720,18 +2720,19 @@ class EmulatorJS {
setupKeys(){
for (let i=0; i<4; i++) {
for (let j=0; j<30; j++) {
if (this.controls[i][j] && this.controls[i][j].value === this.keyMap[this.keyLookup(this.controls[i][j].value)]) {
if (this.controls[i][j] && this.controls[i][j].value === this.keyMap[this.keyLookup(this.controls[i][j])]) {
this.controls[i][j].keycode = Number(this.keyLookup(this.controls[i][j]));
}
}
}
}
keyLookup(k){
keyLookup(controllerkey){
console.log(controllerkey);
for (var key in this.keyMap) {
if (this.keyMap[key] === k.value) {
if (this.keyMap[key] === controllerkey.value) {
return key;
}else if (k.keycode !== undefined) {
return k.keycode;
}else if (controllerkey.keycode !== undefined) {
return controllerkey.keycode;
}
}
return 0;

File diff suppressed because one or more lines are too long