Skip to content

Commit

Permalink
fix(controller): fix controllers multiplier on 0 translates
Browse files Browse the repository at this point in the history
fixes #6498
  • Loading branch information
nolimits4web committed Apr 14, 2023
1 parent 706fdf8 commit 4b8bd02
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/modules/controller/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ export default function Controller({ swiper, extendParams, on }) {
if (!controlledTranslate || swiper.params.controller.by === 'container') {
multiplier =
(c.maxTranslate() - c.minTranslate()) / (swiper.maxTranslate() - swiper.minTranslate());
if (Number.isNaN(multiplier) || !Number.isFinite(multiplier)) {
multiplier = 1;
}
controlledTranslate = (translate - swiper.minTranslate()) * multiplier + c.minTranslate();
}

Expand Down

0 comments on commit 4b8bd02

Please sign in to comment.