dynamic height for series detail (#1321)
* Adding dynamic height function * pushing change requests * Moved method to getter * Changed carousel reel to onpush strat Co-authored-by: Joseph Milazzo <joseph.v.milazzo@gmail.com>
This commit is contained in:
parent
1edf23d8c3
commit
78f0bad144
4 changed files with 19 additions and 7 deletions
|
|
@ -1,10 +1,11 @@
|
|||
import { Component, ContentChild, EventEmitter, Input, Output, TemplateRef } from '@angular/core';
|
||||
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChild, EventEmitter, Input, Output, TemplateRef } from '@angular/core';
|
||||
import { Swiper, SwiperEvents } from 'swiper/types';
|
||||
|
||||
@Component({
|
||||
selector: 'app-carousel-reel',
|
||||
templateUrl: './carousel-reel.component.html',
|
||||
styleUrls: ['./carousel-reel.component.scss']
|
||||
styleUrls: ['./carousel-reel.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
export class CarouselReelComponent {
|
||||
|
||||
|
|
@ -18,7 +19,7 @@ export class CarouselReelComponent {
|
|||
|
||||
trackByIdentity: (index: number, item: any) => string;
|
||||
|
||||
constructor() {
|
||||
constructor(private readonly cdRef: ChangeDetectorRef) {
|
||||
this.trackByIdentity = (index: number, item: any) => `${this.title}_${item.id}_${item?.name}_${item?.pagesRead}_${index}`;
|
||||
}
|
||||
|
||||
|
|
@ -26,6 +27,7 @@ export class CarouselReelComponent {
|
|||
if (this.swiper) {
|
||||
if (this.swiper.isEnd) return;
|
||||
this.swiper.setProgress(this.swiper.progress + 0.25, 600);
|
||||
this.cdRef.markForCheck();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -33,6 +35,7 @@ export class CarouselReelComponent {
|
|||
if (this.swiper) {
|
||||
if (this.swiper.isBeginning) return;
|
||||
this.swiper.setProgress(this.swiper.progress - 0.25, 600);
|
||||
this.cdRef.markForCheck();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -42,5 +45,6 @@ export class CarouselReelComponent {
|
|||
|
||||
onSwiper(eventParams: Parameters<SwiperEvents['init']>) {
|
||||
[this.swiper] = eventParams;
|
||||
this.cdRef.detectChanges();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue