Skip to content

Commit

Permalink
fix(esl-carousel): incomplete carousel should be normalized with non …
Browse files Browse the repository at this point in the history
…loop constraints
  • Loading branch information
ala-n committed Aug 6, 2024
1 parent 4a57c17 commit 2157e6a
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function normalize(index: number, size: number): number {

/** @returns normalize first slide index according to the carousel mode */
export function normalizeIndex(index: number, {size, count, loop}: ESLCarouselStaticState): number {
return loop ? normalize(index, size) : Math.max(0, Math.min(size - count, index));
return loop && count < size ? normalize(index, size) : Math.max(0, Math.min(size - count, index));
}

/** @returns normalized sequence of slides starting from the current index */
Expand Down

0 comments on commit 2157e6a

Please sign in to comment.