From 9f9cc9025452c5415a58554fe6a22cf375126e87 Mon Sep 17 00:00:00 2001 From: Pihkaal Date: Mon, 23 Feb 2026 17:25:29 +0100 Subject: [PATCH] feat(2d-nds): animation to and from gallery --- app/components/NDS2D.vue | 16 +++++++++-- app/stores/gallery.ts | 59 ++++++++++++++++++++++++++++++---------- 2 files changed, 58 insertions(+), 17 deletions(-) diff --git a/app/components/NDS2D.vue b/app/components/NDS2D.vue index a3f5dab..c42b621 100644 --- a/app/components/NDS2D.vue +++ b/app/components/NDS2D.vue @@ -55,6 +55,17 @@ const ndsScale = computed(() => { return Math.min(scaleX, scaleY); }); +const gallery = useGalleryStore(); +const TOP_SCREEN_OFFSET = 170; + +const zoomStyle = computed(() => { + const scale = ndsScale.value * gallery.zoom.scale; + if (scale === 1) return { scale: ndsScale.value }; + + const y = TOP_SCREEN_OFFSET * ndsScale.value * (gallery.zoom.scale - 1); + return { transform: `translateY(${y}px) scale(${scale})` }; +}); + watch( () => app.hintsVisible, async (show) => { @@ -75,13 +86,11 @@ watch( } }, ); - -defineExpose({ ndsScale });