Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(esl-carousel): fix incomplete centered carousel rendering #2557

Merged
merged 2 commits into from
Jul 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading