From 485063f8d230ea5863c3318242d3bcb26c8a203e Mon Sep 17 00:00:00 2001 From: Gleb Koval Date: Thu, 5 Jun 2025 17:47:08 +0100 Subject: [PATCH] feat: multi-image uploads --- src/lib/components/Carousel.svelte | 33 +++++++++----- .../inputs/{Image.svelte => Images.svelte} | 28 +++++++++++- src/routes/space/+page.svelte | 43 +++++++++++-------- 3 files changed, 74 insertions(+), 30 deletions(-) rename src/lib/components/inputs/{Image.svelte => Images.svelte} (63%) diff --git a/src/lib/components/Carousel.svelte b/src/lib/components/Carousel.svelte index b26229c..4eb0777 100644 --- a/src/lib/components/Carousel.svelte +++ b/src/lib/components/Carousel.svelte @@ -12,13 +12,20 @@ let carousel = $state(); let scrollPosition = $state(0); let scrollWidth = $state(0); - let clientWidth = $state(0); + let clientWidth = $state(1); function updateScroll() { scrollPosition = carousel?.scrollLeft || 0; scrollWidth = carousel?.scrollWidth || 0; - clientWidth = carousel?.clientWidth || 0; + clientWidth = carousel?.clientWidth || 1; } - onMount(updateScroll); + onMount(() => { + const id = setInterval(() => { + if (carousel) { + updateScroll(); + } + }, 1000); + return () => clearInterval(id); + });
@@ -37,7 +44,8 @@ {#if scrollPosition > clientWidth / 2}