Skip to content

Commit

Permalink
fix(esl-carousel): fix incomplete centered carousel rendering
Browse files Browse the repository at this point in the history
Co-authored-by: ala'n (Alexey Stsefanovich) <astsefanovich@exadel.com>
  • Loading branch information
abarmina and ala-n committed Jul 31, 2024
1 parent 420056d commit 0d7adce
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 0d7adce

Please sign in to comment.