From 1cc7bfa65fc83405365c1efd798913926ac57ee4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=BB=D0=B0=D0=B4=D0=B8=D0=BC=D0=B8=D1=80=20=D0=91?= =?UTF-8?q?=D1=83=D0=B3=D0=BE=D1=80=D0=BA=D0=BE=D0=B2?= Date: Tue, 19 Dec 2023 22:44:21 +0900 Subject: [PATCH] Galleria bug fix: If change images after images length less numVisible, numVisible remains old images length --- src/app/components/galleria/galleria.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/app/components/galleria/galleria.ts b/src/app/components/galleria/galleria.ts index 1e1db91efee..a1b65b7c5e3 100755 --- a/src/app/components/galleria/galleria.ts +++ b/src/app/components/galleria/galleria.ts @@ -62,7 +62,7 @@ import { platformBrowser } from '@angular/platform-browser'; (@animation.done)="onAnimationEnd($event)" [value]="value" [activeIndex]="activeIndex" - [numVisible]="numVisible" + [numVisible]="numVisibleLimit || numVisible" (maskHide)="onMaskHide()" (activeItemChange)="onActiveItemChange($event)" [ngStyle]="containerStyle" @@ -71,7 +71,7 @@ import { platformBrowser } from '@angular/platform-browser'; - + `, animations: [ @@ -281,6 +281,8 @@ export class Galleria implements OnChanges, OnDestroy { maskVisible: boolean = false; + numVisibleLimit = 0; + constructor(@Inject(DOCUMENT) private document: Document, @Inject(PLATFORM_ID) public platformId: any, public element: ElementRef, public cd: ChangeDetectorRef, public config: PrimeNGConfig) {} ngAfterContentInit() { @@ -327,7 +329,9 @@ export class Galleria implements OnChanges, OnDestroy { ngOnChanges(simpleChanges: SimpleChanges) { if (simpleChanges.value && simpleChanges.value.currentValue?.length < this.numVisible) { - this.numVisible = simpleChanges.value.currentValue.length; + this.numVisibleLimit = simpleChanges.value.currentValue.length; + } else { + this.numVisibleLimit = 0; } }