From a86887a4b8f1055e184508ff284f16e036cdd907 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 27 Mar 2018 17:37:26 +0200 Subject: Fix my videos pagination --- client/src/app/shared/video/abstract-video-list.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'client/src/app/shared/video') diff --git a/client/src/app/shared/video/abstract-video-list.ts b/client/src/app/shared/video/abstract-video-list.ts index 90a88544a..021c285c0 100644 --- a/client/src/app/shared/video/abstract-video-list.ts +++ b/client/src/app/shared/video/abstract-video-list.ts @@ -169,6 +169,11 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy { this.videoPages = Object.values(this.loadedPages) } + protected buildVideoHeight () { + // Same ratios than base width/height + return this.videosElement.nativeElement.offsetWidth * (this.baseVideoHeight / this.baseVideoWidth) + } + private minPageLoaded () { return Math.min(...Object.keys(this.loadedPages).map(e => parseInt(e, 10))) } @@ -183,8 +188,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy { // Video takes all the width this.videoWidth = -1 - // Same ratios than base width/height - this.videoHeight = this.videosElement.nativeElement.offsetWidth * (this.baseVideoHeight / this.baseVideoWidth) + this.videoHeight = this.buildVideoHeight() this.pageHeight = this.pagination.itemsPerPage * this.videoHeight } else { this.videoWidth = this.baseVideoWidth -- cgit v1.2.3