Skip to content

Commit

Permalink
Update KeyHistory.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Mistium authored Sep 5, 2024
1 parent 7edca6c commit b131106
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions featured/KeyHistory.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@
}

// Only add the key if it's not already in keysDown
if (!this.keysDown.includes(key)) {
this.keysDown.push(key);
if (!this.keysDown.includes(lowerkey)) {
this.keysDown.push(lowerkey);
}

if (event.metaKey || event.ctrlKey || this.isKeybind(key) || this.pause) {
Expand All @@ -209,14 +209,14 @@
// Convert the key to a string to ensure consistency
const key = Scratch.Cast.toString(event.key ?? "").toLowerCase();
const lowerkey = key.toLowerCase();
const index = this.keysDown.indexOf(key);
const index = this.keysDown.indexOf(lowerkey);

// Check if the key is actually in the array before trying to remove it
if (index !== -1) {
this.keysDown.splice(index, 1);
}

const hitIndex = this.keysHit.indexOf(lowerkey);
let hitIndex = this.keysHit.indexOf(lowerkey);

if (hitIndex !== -1) {
this.keysHit.splice(hitIndex, 1);
Expand Down

0 comments on commit b131106

Please sign in to comment.