From 5c95274c2bdc252819c3d60f875c72a3c2581d24 Mon Sep 17 00:00:00 2001 From: Pihkaal Date: Thu, 18 Dec 2025 16:33:41 +0100 Subject: [PATCH] feat(projects): disable prev/next at edges --- .../Projects/BottomScreen/Buttons.vue | 39 +++++++++++++++--- .../projects/bottom-screen/next-disabled.webp | Bin 0 -> 144 bytes .../projects/bottom-screen/prev-disabled.webp | Bin 0 -> 142 bytes 3 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 public/images/projects/bottom-screen/next-disabled.webp create mode 100644 public/images/projects/bottom-screen/prev-disabled.webp diff --git a/app/components/Projects/BottomScreen/Buttons.vue b/app/components/Projects/BottomScreen/Buttons.vue index 0a80702..c8e8f63 100644 --- a/app/components/Projects/BottomScreen/Buttons.vue +++ b/app/components/Projects/BottomScreen/Buttons.vue @@ -87,10 +87,16 @@ useScreenClick((x, y) => { ) return; - if (circleContains(BUTTONS.prev.position, [x, y], CLICK_RADIUS)) { + if ( + circleContains(BUTTONS.prev.position, [x, y], CLICK_RADIUS) && + store.currentProject > 0 + ) { startButtonAnimation("prev"); store.scrollProjects("left"); - } else if (circleContains(BUTTONS.next.position, [x, y], CLICK_RADIUS)) { + } else if ( + circleContains(BUTTONS.next.position, [x, y], CLICK_RADIUS) && + store.currentProject < store.projects.length - 1 + ) { startButtonAnimation("next"); store.scrollProjects("right"); } else if (circleContains(BUTTONS.quit.position, [x, y], CLICK_RADIUS)) { @@ -106,6 +112,22 @@ useScreenClick((x, y) => { }); useRender((ctx) => { + // Draw disabled buttons + if (store.currentProject === 0) { + ctx.drawImage( + assets.projects.bottomScreen.prevDisabled, + BUTTONS.prev.position[0] - 14, + BUTTONS.prev.position[1] - 14, + ); + } + if (store.currentProject === store.projects.length - 1) { + ctx.drawImage( + assets.projects.bottomScreen.nextDisabled, + BUTTONS.next.position[0] - 14, + BUTTONS.next.position[1] - 14, + ); + } + if (currentAnimation?.showButton) { const image = BUTTONS[currentAnimation.type].image; ctx.drawImage( @@ -142,14 +164,19 @@ useKeyDown((key) => { store.showConfirmationPopup ) return; + switch (key) { case "NDS_LEFT": - startButtonAnimation("prev"); - store.scrollProjects("left"); + if (store.currentProject > 0) { + startButtonAnimation("prev"); + store.scrollProjects("left"); + } break; case "NDS_RIGHT": - startButtonAnimation("next"); - store.scrollProjects("right"); + if (store.currentProject < store.projects.length - 1) { + startButtonAnimation("next"); + store.scrollProjects("right"); + } break; case "NDS_A": case "NDS_START": diff --git a/public/images/projects/bottom-screen/next-disabled.webp b/public/images/projects/bottom-screen/next-disabled.webp new file mode 100644 index 0000000000000000000000000000000000000000..ef6bab872cae3b84a1eeb68b89136fff478cc61e GIT binary patch literal 144 zcmV;B0B`?NNk&G900012MM6+kP&iC{0000l8vq9owKxjEHf|6XN?{aAiFK|d4?zxn z_3tzO4&Q%9ZretZ>~5!a<`)BaemS`IrC1M?6<(0?z$$^(NhW55sxS2!8!vpC`a literal 0 HcmV?d00001 diff --git a/public/images/projects/bottom-screen/prev-disabled.webp b/public/images/projects/bottom-screen/prev-disabled.webp new file mode 100644 index 0000000000000000000000000000000000000000..ba9318ed8dd811bff0aeb80b900727aaa575ee54 GIT binary patch literal 142 zcmV;90CE3PNk&G700012MM6+kP&iC^0000l8vq9owXkU;NfP3Paxf0c5!55PJUB{_&%F#hTCLNVQDiFueeg%1 wPl9EoLMT`ciNazibwLHg__*@?uH;Gdy->U(l>=*k$3XZOvT4JJ<_dQV02zWp7ytkO literal 0 HcmV?d00001