From b2313d5f0496af4f28661493cb01376613e18719 Mon Sep 17 00:00:00 2001 From: Vladimir Kharlampidi Date: Tue, 17 Jan 2023 13:11:57 +0300 Subject: [PATCH] fix(core): make isBeginning and isEnd true when translate is less than 1px diff fixes #6287 --- src/core/update/updateProgress.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/core/update/updateProgress.js b/src/core/update/updateProgress.js index 65c516bb8..4bfb4163e 100644 --- a/src/core/update/updateProgress.js +++ b/src/core/update/updateProgress.js @@ -18,8 +18,12 @@ export default function updateProgress(translate) { isEnd = true; } else { progress = (translate - swiper.minTranslate()) / translatesDiff; - isBeginning = progress <= 0; - isEnd = progress >= 1; + const isBeginningRounded = Math.abs(translate - swiper.minTranslate()) < 1; + const isEndRounded = Math.abs(translate - swiper.maxTranslate()) < 1; + isBeginning = isBeginningRounded || progress <= 0; + isEnd = isEndRounded || progress >= 1; + if (isBeginningRounded) progress = 0; + if (isEndRounded) progress = 1; } if (params.loop) {