From 437cfc0e79aa02c8bbdf9b004f04ea4e2610c17b Mon Sep 17 00:00:00 2001 From: Pihkaal Date: Fri, 2 Jan 2026 14:14:15 +0100 Subject: [PATCH] fix(gallery): disable animation after resizing to avoid duplicate animation --- app/pages/gallery.vue | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/app/pages/gallery.vue b/app/pages/gallery.vue index 1e80450..f7e4c99 100644 --- a/app/pages/gallery.vue +++ b/app/pages/gallery.vue @@ -2,8 +2,13 @@ import { LazyGalleryModal } from "#components"; import type { InternalApi } from "nitropack/types"; +// TODO: only play intro anim ONCE +// currently, if lane count changes, the animation is being replayed and it's shit + const images = ref([]); +const resized = ref(false); + const scrollArea = ref(); const overlay = useOverlay(); const galleryModal = overlay.create(LazyGalleryModal); @@ -26,6 +31,7 @@ const openModal = async (index: number) => { const lanes = ref(3); const updateLanes = () => { + const previousValue = lanes.value; if (window.innerWidth < 768) { lanes.value = 1; } else if (window.innerWidth < 1152) { @@ -33,6 +39,10 @@ const updateLanes = () => { } else { lanes.value = 3; } + + if (previousValue !== lanes.value) { + resized.value = true; + } }; const { data: galleryPhotos } = await useAsyncData("gallery", () => @@ -94,9 +104,15 @@ onUnmounted(() => {