feat(projects): disable prev/next at edges
This commit is contained in:
@@ -87,10 +87,16 @@ useScreenClick((x, y) => {
|
|||||||
)
|
)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (circleContains(BUTTONS.prev.position, [x, y], CLICK_RADIUS)) {
|
if (
|
||||||
|
circleContains(BUTTONS.prev.position, [x, y], CLICK_RADIUS) &&
|
||||||
|
store.currentProject > 0
|
||||||
|
) {
|
||||||
startButtonAnimation("prev");
|
startButtonAnimation("prev");
|
||||||
store.scrollProjects("left");
|
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");
|
startButtonAnimation("next");
|
||||||
store.scrollProjects("right");
|
store.scrollProjects("right");
|
||||||
} else if (circleContains(BUTTONS.quit.position, [x, y], CLICK_RADIUS)) {
|
} else if (circleContains(BUTTONS.quit.position, [x, y], CLICK_RADIUS)) {
|
||||||
@@ -106,6 +112,22 @@ useScreenClick((x, y) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
useRender((ctx) => {
|
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) {
|
if (currentAnimation?.showButton) {
|
||||||
const image = BUTTONS[currentAnimation.type].image;
|
const image = BUTTONS[currentAnimation.type].image;
|
||||||
ctx.drawImage(
|
ctx.drawImage(
|
||||||
@@ -142,14 +164,19 @@ useKeyDown((key) => {
|
|||||||
store.showConfirmationPopup
|
store.showConfirmationPopup
|
||||||
)
|
)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case "NDS_LEFT":
|
case "NDS_LEFT":
|
||||||
startButtonAnimation("prev");
|
if (store.currentProject > 0) {
|
||||||
store.scrollProjects("left");
|
startButtonAnimation("prev");
|
||||||
|
store.scrollProjects("left");
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "NDS_RIGHT":
|
case "NDS_RIGHT":
|
||||||
startButtonAnimation("next");
|
if (store.currentProject < store.projects.length - 1) {
|
||||||
store.scrollProjects("right");
|
startButtonAnimation("next");
|
||||||
|
store.scrollProjects("right");
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "NDS_A":
|
case "NDS_A":
|
||||||
case "NDS_START":
|
case "NDS_START":
|
||||||
|
|||||||
BIN
public/images/projects/bottom-screen/next-disabled.webp
Normal file
BIN
public/images/projects/bottom-screen/next-disabled.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 144 B |
BIN
public/images/projects/bottom-screen/prev-disabled.webp
Normal file
BIN
public/images/projects/bottom-screen/prev-disabled.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 142 B |
Reference in New Issue
Block a user