Skip to content

Commit

Permalink
Merge pull request #2557 from exadel-inc/fix/centered-esl-carousel
Browse files Browse the repository at this point in the history
fix(esl-carousel): fix incomplete centered carousel rendering
  • Loading branch information
abarmina authored Jul 31, 2024
2 parents 38b3bc7 + 2108124 commit 2f6b8a5
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,24 @@ export class ESLCenteredCarouselRenderer extends ESLDefaultCarouselRenderer {
public static override is = 'centered';
public static override classes: string[] = ['esl-carousel-centered-renderer', 'esl-carousel-default-renderer'];

/** @returns size of all active slides */
/** Size of all active slides */
public get activeSlidesSize(): number {
let width = (this.count - 1) * this.gap;
for (let i = 0; i < this.count; i++) {
const count = Math.min(this.count, this.size);
let width = (count - 1) * this.gap;
for (let i = 0; i < count; i++) {
const position = normalize(i + this.currentIndex, this.size);
const $slide = this.$slides[position];
width += this.vertical ? $slide.offsetHeight : $slide.offsetWidth;
}
return width;
}

/** @returns carousel size */
/** Carousel size */
public get carouselSize(): number {
return this.vertical ? this.$carousel.clientHeight : this.$carousel.clientWidth;
}

/** @returns carousel padding value */
/** Carousel padding value */
public get carouselPadding(): number {
const carouselStyles = getComputedStyle(this.$carousel);
return parseFloat(carouselStyles[this.vertical ? 'paddingTop' : 'paddingLeft']);
Expand Down

0 comments on commit 2f6b8a5

Please sign in to comment.