From 7942bd172333a1892d070edf6a90c291d0d0a0af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=A7=88=EC=A1=B0=EB=A6=AC=EC=B9=B4?= Date: Wed, 16 Apr 2025 14:52:07 +0900 Subject: [PATCH] fix: add direction tracking to carousel transitions --- src/lib/carousel/Carousel.svelte | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/carousel/Carousel.svelte b/src/lib/carousel/Carousel.svelte index 7e5e24b61..8374c0adc 100644 --- a/src/lib/carousel/Carousel.svelte +++ b/src/lib/carousel/Carousel.svelte @@ -18,7 +18,7 @@ import Indicators from './Indicators.svelte'; import Slide from './Slide.svelte'; import { canChangeSlide } from './CarouselSlide'; - import type { ParamsType } from '../types' + import type { ParamsType } from '../types'; type TransitionFunc = (node: HTMLElement, params: ParamsType) => TransitionConfig; const SLIDE_DURATION_RATIO = 0.25; // TODO: Expose one day? @@ -61,6 +61,7 @@ _state.index = _state.index >= images.length - 1 ? 0 : _state.index + 1; _state.lastSlideChange = new Date(); + _state.forward = true; return { ..._state }; }); }; @@ -71,6 +72,7 @@ _state.index = _state.index <= 0 ? images.length - 1 : _state.index - 1; _state.lastSlideChange = new Date(); + _state.forward = false; return { ..._state }; }); };