refactor(contact): use CommonButtons @activate events
This commit is contained in:
@@ -69,33 +69,6 @@ const actionateButton = async (button: (typeof selectedButton)["value"]) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: use @activate events from common buttons
|
|
||||||
|
|
||||||
const QUIT_BUTTON: Rect = [31, 172, 80, 18];
|
|
||||||
const OK_BUTTON: Rect = [144, 172, 80, 18];
|
|
||||||
|
|
||||||
useScreenClick((x, y) => {
|
|
||||||
if (modalState.value.isOpen || store.isIntro || store.isOutro) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rectContains(QUIT_BUTTON, [x, y])) {
|
|
||||||
store.animateOutro();
|
|
||||||
} else if (rectContains(OK_BUTTON, [x, y])) {
|
|
||||||
actionateButton(selectedButton.value);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
useKeyDown((key) => {
|
|
||||||
if (modalState.value.isOpen || store.isIntro || store.isOutro) return;
|
|
||||||
|
|
||||||
switch (key) {
|
|
||||||
case "NDS_B":
|
|
||||||
store.animateOutro();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -130,5 +103,7 @@ useKeyDown((key) => {
|
|||||||
"
|
"
|
||||||
b-label="Quit"
|
b-label="Quit"
|
||||||
:a-label="ACTIONS[selectedButton][0]"
|
:a-label="ACTIONS[selectedButton][0]"
|
||||||
|
@activate-a="actionateButton(selectedButton)"
|
||||||
|
@activate-b="store.animateOutro()"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user