Fix pagination when videos take all the width
This commit is contained in:
parent
bffbebbe6b
commit
1ff8d7d631
|
@ -9,7 +9,7 @@
|
||||||
myInfiniteScroller
|
myInfiniteScroller
|
||||||
[pageHeight]="pageHeight"
|
[pageHeight]="pageHeight"
|
||||||
(nearOfTop)="onNearOfTop()" (nearOfBottom)="onNearOfBottom()" (pageChanged)="onPageChanged($event)"
|
(nearOfTop)="onNearOfTop()" (nearOfBottom)="onNearOfBottom()" (pageChanged)="onPageChanged($event)"
|
||||||
class="videos" #videoElement
|
class="videos" #videosElement
|
||||||
>
|
>
|
||||||
<div *ngFor="let videos of videoPages" class="videos-page">
|
<div *ngFor="let videos of videoPages" class="videos-page">
|
||||||
<my-video-miniature
|
<my-video-miniature
|
||||||
|
|
|
@ -15,7 +15,7 @@ import { Video } from './video.model'
|
||||||
export abstract class AbstractVideoList implements OnInit, OnDestroy {
|
export abstract class AbstractVideoList implements OnInit, OnDestroy {
|
||||||
private static LINES_PER_PAGE = 3
|
private static LINES_PER_PAGE = 3
|
||||||
|
|
||||||
@ViewChild('videoElement') videosElement: ElementRef
|
@ViewChild('videosElement') videosElement: ElementRef
|
||||||
@ViewChild(InfiniteScrollerDirective) infiniteScroller: InfiniteScrollerDirective
|
@ViewChild(InfiniteScrollerDirective) infiniteScroller: InfiniteScrollerDirective
|
||||||
|
|
||||||
pagination: ComponentPagination = {
|
pagination: ComponentPagination = {
|
||||||
|
@ -183,6 +183,8 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy {
|
||||||
|
|
||||||
// Video takes all the width
|
// Video takes all the width
|
||||||
this.videoWidth = -1
|
this.videoWidth = -1
|
||||||
|
// Same ratios than base width/height
|
||||||
|
this.videoHeight = this.videosElement.nativeElement.offsetWidth * (this.baseVideoHeight / this.baseVideoWidth)
|
||||||
this.pageHeight = this.pagination.itemsPerPage * this.videoHeight
|
this.pageHeight = this.pagination.itemsPerPage * this.videoHeight
|
||||||
} else {
|
} else {
|
||||||
this.videoWidth = this.baseVideoWidth
|
this.videoWidth = this.baseVideoWidth
|
||||||
|
|
Loading…
Reference in New Issue