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/account/account-videos/account-videos.component.ts | 5 +++++ client/src/app/shared/video/abstract-video-list.ts | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/client/src/app/account/account-videos/account-videos.component.ts b/client/src/app/account/account-videos/account-videos.component.ts index cd0f8e752..4f2f3e242 100644 --- a/client/src/app/account/account-videos/account-videos.component.ts +++ b/client/src/app/account/account-videos/account-videos.component.ts @@ -106,6 +106,11 @@ export class AccountVideosComponent extends AbstractVideoList implements OnInit, ) } + protected buildVideoHeight () { + // In account videos, the video height is fixed + return this.baseVideoHeight + } + private spliceVideosById (id: number) { for (const key of Object.keys(this.loadedPages)) { const videos = this.loadedPages[key] 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