Skip to content

Commit

Permalink
Galleria bug fix: If change images after images length less numVisibl…
Browse files Browse the repository at this point in the history
…e, numVisible remains old images length
  • Loading branch information
Владимир Бугорков committed Dec 19, 2023
1 parent 5776ac0 commit 1cc7bfa
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/app/components/galleria/galleria.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -71,7 +71,7 @@ import { platformBrowser } from '@angular/platform-browser';
</div>
<ng-template #windowed>
<p-galleriaContent [value]="value" [activeIndex]="activeIndex" [numVisible]="numVisible" (activeItemChange)="onActiveItemChange($event)"></p-galleriaContent>
<p-galleriaContent [value]="value" [activeIndex]="activeIndex" [numVisible]="numVisibleLimit || numVisible" (activeItemChange)="onActiveItemChange($event)"></p-galleriaContent>
</ng-template>
`,
animations: [
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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;
}
}

Expand Down

0 comments on commit 1cc7bfa

Please sign in to comment.