feat(nds): improve some button interactions

This commit is contained in:
2026-02-10 17:00:11 +01:00
parent 93e6922b68
commit 069884123b
5 changed files with 18 additions and 8 deletions

View File

@@ -8,8 +8,8 @@ const QUIT_SIZE = assets.images.achievements.quit.rect.width;
const QUIT_X = Math.floor(LOGICAL_WIDTH / 2 - QUIT_SIZE / 2);
const QUIT_Y = 135;
useKeyDown(({ key }) => {
if (store.isIntro || store.isOutro) return;
useKeyDown(({ key, repeated }) => {
if (store.isIntro || store.isOutro || repeated) return;
switch (key) {
case "NDS_B":

View File

@@ -110,8 +110,8 @@ onClick((x, y) => {
}
});
useKeyDown(({ key }) => {
if (props.yOffset !== 0) return;
useKeyDown(({ key, repeated }) => {
if (props.yOffset !== 0 || repeated) return;
switch (key) {
case "NDS_START":
case "NDS_A":

View File

@@ -56,6 +56,11 @@ const { selected, selectorPosition } = useButtonNavigation({
},
});
const handleActivateB = () => {
if (store.isIntro || store.isOutro) return;
store.animateOutro();
};
const actionateButton = async (button: (typeof selected)["value"]) => {
const [action, verbKey, content] = ACTIONS[button];
const verb = $t(verbKey);
@@ -118,6 +123,6 @@ const actionateButton = async (button: (typeof selected)["value"]) => {
"
:b-label="$t('common.quit')"
:a-label="$t(`contact.actions.${ACTIONS[selected][0]}`)"
@activate-b="store.animateOutro()"
@activate-b="handleActivateB"
/>
</template>

View File

@@ -162,7 +162,8 @@ onRender((ctx) => {
ctx.fillStyle = `rgba(0, 0, 0, ${store.isIntro ? store.intro.fadeOpacity : store.isOutro ? store.outro.fadeOpacity : 0})`;
ctx.fillRect(0, 0, LOGICAL_WIDTH, LOGICAL_HEIGHT);
});
useKeyDown(({ key }) => {
useKeyDown(({ key, repeated }) => {
if (
currentAnimation ||
store.isIntro ||
@@ -185,11 +186,15 @@ useKeyDown(({ key }) => {
}
break;
case "NDS_B":
if (repeated) break;
startButtonAnimation("quit");
store.animateOutro();
break;
case "NDS_A":
case "NDS_START":
if (repeated) break;
startButtonAnimation("link");
setTimeout(
() => (store.showConfirmationPopup = true),

View File

@@ -221,8 +221,8 @@ export const useButtonNavigation = <T extends Record<string, Rect>>({
}
});
useKeyDown(({ key }) => {
if (blockInteractions.value) return;
useKeyDown(({ key, repeated }) => {
if (blockInteractions.value || repeated) return;
const currentButton = selectedButton.value as Entry;
const currentNav = navigation[currentButton];