Skip to content

Commit

Permalink
Merge pull request #14402 from Darkcooder/master
Browse files Browse the repository at this point in the history
Galleria bug fix: If change images after images length less numVisibl…
  • Loading branch information
cetincakiroglu authored Dec 20, 2023
2 parents 8433e32 + 1cc7bfa commit 123510c
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 123510c

Please sign in to comment.