feat(settings): block interactions while animation is happening
This commit is contained in:
@@ -8,19 +8,24 @@ const BIRTHDAY_DAY = 25;
|
||||
const BIRTHDAY_MONTH = 4;
|
||||
const BIRTHDAY_YEAR = 2002;
|
||||
|
||||
const isAnimating = ref(true);
|
||||
|
||||
const monthRef = useTemplateRef<InstanceType<typeof NumberInput>>("month");
|
||||
const dayRef = useTemplateRef<InstanceType<typeof NumberInput>>("day");
|
||||
const yearRef = useTemplateRef<InstanceType<typeof NumberInput>>("year");
|
||||
|
||||
const animateIntro = async () => {
|
||||
isAnimating.value = true;
|
||||
await Promise.all([
|
||||
monthRef.value?.animateIntro(),
|
||||
dayRef.value?.animateIntro(),
|
||||
yearRef.value?.animateIntro(),
|
||||
]);
|
||||
isAnimating.value = false;
|
||||
};
|
||||
|
||||
const animateOutro = async () => {
|
||||
isAnimating.value = true;
|
||||
await Promise.all([
|
||||
monthRef.value?.animateOutro(),
|
||||
dayRef.value?.animateOutro(),
|
||||
@@ -33,11 +38,13 @@ onMounted(() => {
|
||||
});
|
||||
|
||||
const handleActivateB = async () => {
|
||||
if (isAnimating.value) return;
|
||||
await animateOutro();
|
||||
store.closeSubMenu();
|
||||
};
|
||||
|
||||
const handleActivateA = () => {
|
||||
if (isAnimating.value) return;
|
||||
const today = new Date();
|
||||
const currentYear = today.getFullYear();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user