From b2e7947fb384f86c34eb8c51c140030e2a77f0b8 Mon Sep 17 00:00:00 2001 From: isark Date: Wed, 15 Nov 2023 20:05:49 +0100 Subject: [PATCH] Fixed bug when initializing at at low indices introduced last commit --- src/app/carousel/carousel.component.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/app/carousel/carousel.component.ts b/src/app/carousel/carousel.component.ts index d509f58..70d8890 100644 --- a/src/app/carousel/carousel.component.ts +++ b/src/app/carousel/carousel.component.ts @@ -131,8 +131,7 @@ export class CarouselComponent implements OnInit, AfterViewInit { setIndex(slideIndex: number) { this.current = slideIndex; - for(let i = -this.numExtraPrev(); i <= this.numExtraNext(); i++) { - console.log("adding slide:", this.current + i); + for(let i = Math.max(-this.numExtraPrev(), 0); i <= this.numExtraNext(); i++) { this.visibleSlides?.push({ index: this.current + i, hasBeenVisible: false,