From 4847fcba5dbe34caa91ea23b0bb72c8d40da0e63 Mon Sep 17 00:00:00 2001 From: Vladimir Kharlampidi Date: Wed, 31 Jul 2024 13:52:35 +0300 Subject: [PATCH] fix(core): fix loop missing slides with centeredSlides fixes #7584 --- src/core/events/onTouchMove.mjs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/core/events/onTouchMove.mjs b/src/core/events/onTouchMove.mjs index 2e9e39e73..85a23f4c6 100644 --- a/src/core/events/onTouchMove.mjs +++ b/src/core/events/onTouchMove.mjs @@ -226,7 +226,12 @@ export default function onTouchMove(event) { data.allowThresholdMove && data.currentTranslate > (params.centeredSlides - ? swiper.minTranslate() - swiper.slidesSizesGrid[swiper.activeIndex + 1] + ? swiper.minTranslate() - + swiper.slidesSizesGrid[swiper.activeIndex + 1] - + (params.slidesPerView !== 'auto' && swiper.slides.length - params.slidesPerView >= 2 + ? swiper.slidesSizesGrid[swiper.activeIndex + 1] + swiper.params.spaceBetween + : 0) - + swiper.params.spaceBetween : swiper.minTranslate()) ) { swiper.loopFix({ direction: 'prev', setTranslate: true, activeSlideIndex: 0 }); @@ -248,7 +253,13 @@ export default function onTouchMove(event) { data.allowThresholdMove && data.currentTranslate < (params.centeredSlides - ? swiper.maxTranslate() + swiper.slidesSizesGrid[swiper.slidesSizesGrid.length - 1] + ? swiper.maxTranslate() + + swiper.slidesSizesGrid[swiper.slidesSizesGrid.length - 1] + + swiper.params.spaceBetween + + (params.slidesPerView !== 'auto' && swiper.slides.length - params.slidesPerView >= 2 + ? swiper.slidesSizesGrid[swiper.slidesSizesGrid.length - 1] + + swiper.params.spaceBetween + : 0) : swiper.maxTranslate()) ) { swiper.loopFix({