fix(nds): really case insensitive input
This commit is contained in:
@@ -212,12 +212,16 @@ const keyToButton: Record<string, string> = {
|
|||||||
s: "B",
|
s: "B",
|
||||||
w: "X",
|
w: "X",
|
||||||
a: "Y",
|
a: "Y",
|
||||||
|
D: "A",
|
||||||
|
S: "B",
|
||||||
|
W: "X",
|
||||||
|
A: "Y",
|
||||||
" ": "SELECT",
|
" ": "SELECT",
|
||||||
Enter: "START",
|
Enter: "START",
|
||||||
};
|
};
|
||||||
|
|
||||||
useKeyDown((key) => {
|
useKeyDown((key) => {
|
||||||
const button = keyToButton[key.toLowerCase()];
|
const button = keyToButton[key];
|
||||||
if (button) {
|
if (button) {
|
||||||
physicalButtonsDown.add(button);
|
physicalButtonsDown.add(button);
|
||||||
window.dispatchEvent(
|
window.dispatchEvent(
|
||||||
@@ -227,7 +231,7 @@ useKeyDown((key) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
useKeyUp((key) => {
|
useKeyUp((key) => {
|
||||||
const button = keyToButton[key.toLowerCase()];
|
const button = keyToButton[key];
|
||||||
if (button) {
|
if (button) {
|
||||||
physicalButtonsDown.delete(button);
|
physicalButtonsDown.delete(button);
|
||||||
window.dispatchEvent(new KeyboardEvent("keyup", { key: `NDS_${button}` }));
|
window.dispatchEvent(new KeyboardEvent("keyup", { key: `NDS_${button}` }));
|
||||||
|
|||||||
@@ -24,6 +24,10 @@ const keyToButton: Record<string, string> = {
|
|||||||
s: "B",
|
s: "B",
|
||||||
z: "X",
|
z: "X",
|
||||||
q: "Y",
|
q: "Y",
|
||||||
|
D: "A",
|
||||||
|
S: "B",
|
||||||
|
Z: "X",
|
||||||
|
Q: "Y",
|
||||||
" ": "SELECT",
|
" ": "SELECT",
|
||||||
Enter: "START",
|
Enter: "START",
|
||||||
};
|
};
|
||||||
@@ -34,7 +38,7 @@ const keyToButton: Record<string, string> = {
|
|||||||
// like who choose Nuxt to build such an app
|
// like who choose Nuxt to build such an app
|
||||||
useKeyDown((key) => {
|
useKeyDown((key) => {
|
||||||
if (app.settings.renderingMode === "3d") return;
|
if (app.settings.renderingMode === "3d") return;
|
||||||
const button = keyToButton[key.toLowerCase()];
|
const button = keyToButton[key];
|
||||||
if (button) {
|
if (button) {
|
||||||
window.dispatchEvent(
|
window.dispatchEvent(
|
||||||
new KeyboardEvent("keydown", { key: `NDS_${button}` }),
|
new KeyboardEvent("keydown", { key: `NDS_${button}` }),
|
||||||
@@ -60,7 +64,7 @@ useKeyDown((key) => {
|
|||||||
|
|
||||||
useKeyUp((key) => {
|
useKeyUp((key) => {
|
||||||
if (app.settings.renderingMode === "3d") return;
|
if (app.settings.renderingMode === "3d") return;
|
||||||
const button = keyToButton[key.toLowerCase()];
|
const button = keyToButton[key];
|
||||||
if (button) {
|
if (button) {
|
||||||
window.dispatchEvent(new KeyboardEvent("keyup", { key: `NDS_${button}` }));
|
window.dispatchEvent(new KeyboardEvent("keyup", { key: `NDS_${button}` }));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user