Fix my videos pagination

pull/425/head
Chocobozzz 2018-03-27 17:37:26 +02:00
parent 5b5e333f06
commit a86887a4b8
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 11 additions and 2 deletions

View File

@ -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) { private spliceVideosById (id: number) {
for (const key of Object.keys(this.loadedPages)) { for (const key of Object.keys(this.loadedPages)) {
const videos = this.loadedPages[key] const videos = this.loadedPages[key]

View File

@ -169,6 +169,11 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy {
this.videoPages = Object.values(this.loadedPages) 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 () { private minPageLoaded () {
return Math.min(...Object.keys(this.loadedPages).map(e => parseInt(e, 10))) 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 // Video takes all the width
this.videoWidth = -1 this.videoWidth = -1
// Same ratios than base width/height this.videoHeight = this.buildVideoHeight()
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