feat(settings): block interactions while animation is happening
This commit is contained in:
@@ -21,10 +21,13 @@ const animation = reactive({
|
||||
opacity: 0,
|
||||
});
|
||||
|
||||
const isAnimating = ref(true);
|
||||
|
||||
const hourRef = useTemplateRef<InstanceType<typeof NumberInput>>("hour");
|
||||
const minuteRef = useTemplateRef<InstanceType<typeof NumberInput>>("minute");
|
||||
|
||||
const animateIntro = async () => {
|
||||
isAnimating.value = true;
|
||||
await Promise.all([
|
||||
hourRef.value?.animateIntro(),
|
||||
minuteRef.value?.animateIntro(),
|
||||
@@ -33,9 +36,11 @@ const animateIntro = async () => {
|
||||
.to(animation, { offsetY: 0, duration: SLIDE_DURATION, ease: "none" }, 0)
|
||||
.to(animation, { opacity: 1, duration: SLIDE_DURATION, ease: "none" }, 0),
|
||||
]);
|
||||
isAnimating.value = false;
|
||||
};
|
||||
|
||||
const animateOutro = async () => {
|
||||
isAnimating.value = true;
|
||||
await Promise.all([
|
||||
hourRef.value?.animateOutro(),
|
||||
minuteRef.value?.animateOutro(),
|
||||
@@ -55,11 +60,13 @@ onMounted(() => {
|
||||
});
|
||||
|
||||
const handleCancel = async () => {
|
||||
if (isAnimating.value) return;
|
||||
await animateOutro();
|
||||
store.closeSubMenu();
|
||||
};
|
||||
|
||||
const handleConfirm = async () => {
|
||||
if (isAnimating.value) return;
|
||||
await animateOutro();
|
||||
store.closeSubMenu();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user