Skip to content

Commit

Permalink
fix(core): make isBeginning and isEnd true when translate is less tha…
Browse files Browse the repository at this point in the history
…n 1px diff

fixes #6287
  • Loading branch information
nolimits4web committed Jan 17, 2023
1 parent d88df61 commit b2313d5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/core/update/updateProgress.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit b2313d5

Please sign in to comment.