From 15dc7f4dc6991040bd3c37764898431f80a7cf45 Mon Sep 17 00:00:00 2001 From: sunxd <741175772@qq.com> Date: Sat, 18 Feb 2023 16:48:58 +0800 Subject: [PATCH] fix: centeredSlidesBounds don't work when grid.rows > 1 --- src/core/update/updateSlides.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/core/update/updateSlides.js b/src/core/update/updateSlides.js index 079c549de..f015c3516 100644 --- a/src/core/update/updateSlides.js +++ b/src/core/update/updateSlides.js @@ -260,12 +260,7 @@ export default function updateSlides() { } if (params.centeredSlides && params.centeredSlidesBounds) { - let allSlidesSize = 0; - slidesSizesGrid.forEach((slideSizeValue) => { - allSlidesSize += slideSizeValue + (params.spaceBetween ? params.spaceBetween : 0); - }); - allSlidesSize -= params.spaceBetween; - const maxSnap = allSlidesSize - swiperSize; + const maxSnap = swiper.virtualSize - swiperSize; snapGrid = snapGrid.map((snap) => { if (snap < 0) return -offsetBefore; if (snap > maxSnap) return maxSnap + offsetAfter;