fix: block interactions when animation is happening
This commit is contained in:
@@ -43,9 +43,10 @@ const { selectedButton, selectorPosition } = useButtonNavigation({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
initialButton: "github",
|
initialButton: "github",
|
||||||
onButtonClick: async (button) => {
|
onButtonClick: (button) => {
|
||||||
actionateButton(button);
|
actionateButton(button);
|
||||||
},
|
},
|
||||||
|
disabled: computed(() => store.isIntro || store.isOutro),
|
||||||
});
|
});
|
||||||
|
|
||||||
const actionateButton = async (button: (typeof selectedButton)["value"]) => {
|
const actionateButton = async (button: (typeof selectedButton)["value"]) => {
|
||||||
@@ -71,7 +72,7 @@ const QUIT_BUTTON: Rect = [31, 172, 80, 18];
|
|||||||
const OK_BUTTON: Rect = [144, 172, 80, 18];
|
const OK_BUTTON: Rect = [144, 172, 80, 18];
|
||||||
|
|
||||||
useScreenClick((x, y) => {
|
useScreenClick((x, y) => {
|
||||||
if (modalState.value.isOpen) {
|
if (modalState.value.isOpen || store.isIntro || store.isOutro) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,7 +84,7 @@ useScreenClick((x, y) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
useKeyDown((key) => {
|
useKeyDown((key) => {
|
||||||
if (modalState.value.isOpen) return;
|
if (modalState.value.isOpen || store.isIntro || store.isOutro) return;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case "NDS_B":
|
case "NDS_B":
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ const { selectedButton, selectorPosition } = useButtonNavigation({
|
|||||||
left: "settings",
|
left: "settings",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
disabled: computed(() => store.isIntro || store.isOutro),
|
||||||
});
|
});
|
||||||
|
|
||||||
const getButtonOffset = (button: (typeof selectedButton)["value"]) => {
|
const getButtonOffset = (button: (typeof selectedButton)["value"]) => {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ export const useButtonNavigation = <T extends Record<string, ButtonConfig>>({
|
|||||||
initialButton,
|
initialButton,
|
||||||
onButtonClick,
|
onButtonClick,
|
||||||
navigation,
|
navigation,
|
||||||
|
disabled,
|
||||||
}: {
|
}: {
|
||||||
buttons: T;
|
buttons: T;
|
||||||
initialButton: keyof T;
|
initialButton: keyof T;
|
||||||
@@ -19,6 +20,7 @@ export const useButtonNavigation = <T extends Record<string, ButtonConfig>>({
|
|||||||
horizontalMode?: "navigate" | "preview";
|
horizontalMode?: "navigate" | "preview";
|
||||||
}
|
}
|
||||||
>;
|
>;
|
||||||
|
disabled?: Ref<boolean>;
|
||||||
}) => {
|
}) => {
|
||||||
const { state: modalState } = useConfirmationModal();
|
const { state: modalState } = useConfirmationModal();
|
||||||
|
|
||||||
@@ -28,7 +30,7 @@ export const useButtonNavigation = <T extends Record<string, ButtonConfig>>({
|
|||||||
const nextButton = ref<keyof T | undefined>();
|
const nextButton = ref<keyof T | undefined>();
|
||||||
|
|
||||||
useScreenClick((x: number, y: number) => {
|
useScreenClick((x: number, y: number) => {
|
||||||
if (modalState.value.isOpen) return;
|
if (modalState.value.isOpen || disabled?.value) return;
|
||||||
|
|
||||||
for (const [buttonName, config] of Object.entries(buttons) as [
|
for (const [buttonName, config] of Object.entries(buttons) as [
|
||||||
keyof T,
|
keyof T,
|
||||||
@@ -56,7 +58,7 @@ export const useButtonNavigation = <T extends Record<string, ButtonConfig>>({
|
|||||||
});
|
});
|
||||||
|
|
||||||
useKeyDown((key) => {
|
useKeyDown((key) => {
|
||||||
if (modalState.value.isOpen) return;
|
if (modalState.value.isOpen || disabled?.value) return;
|
||||||
|
|
||||||
const currentButton = selectedButton.value as keyof T;
|
const currentButton = selectedButton.value as keyof T;
|
||||||
const currentNav = navigation[currentButton];
|
const currentNav = navigation[currentButton];
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export const useContactStore = defineStore("contact", {
|
|||||||
},
|
},
|
||||||
|
|
||||||
isIntro: true,
|
isIntro: true,
|
||||||
isOutro: true,
|
isOutro: false,
|
||||||
|
|
||||||
notifications: [] as string[],
|
notifications: [] as string[],
|
||||||
notificationsYOffset: 0,
|
notificationsYOffset: 0,
|
||||||
@@ -30,13 +30,8 @@ export const useContactStore = defineStore("contact", {
|
|||||||
animateIntro() {
|
animateIntro() {
|
||||||
this.isIntro = true;
|
this.isIntro = true;
|
||||||
|
|
||||||
const timeline = gsap.timeline({
|
gsap
|
||||||
onComplete: () => {
|
.timeline()
|
||||||
this.isIntro = false;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
timeline
|
|
||||||
.fromTo(
|
.fromTo(
|
||||||
this.intro,
|
this.intro,
|
||||||
{
|
{
|
||||||
@@ -76,7 +71,10 @@ export const useContactStore = defineStore("contact", {
|
|||||||
ease: "none",
|
ease: "none",
|
||||||
},
|
},
|
||||||
2.3,
|
2.3,
|
||||||
);
|
)
|
||||||
|
.call(() => {
|
||||||
|
this.isIntro = false;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
pushNotification(content: string) {
|
pushNotification(content: string) {
|
||||||
|
|||||||
Reference in New Issue
Block a user