Fix pagination when videos take all the width
authorChocobozzz <me@florianbigard.com>
Wed, 21 Mar 2018 16:28:15 +0000 (17:28 +0100)
committerChocobozzz <me@florianbigard.com>
Wed, 21 Mar 2018 16:28:15 +0000 (17:28 +0100)
client/src/app/shared/video/abstract-video-list.html
client/src/app/shared/video/abstract-video-list.ts

index fb7f8685281f8684883013d2edd07b338f114fe2..94a38019dea4fd34f992aba23ba64054c1b7db3c 100644 (file)
@@ -9,7 +9,7 @@
     myInfiniteScroller
     [pageHeight]="pageHeight"
     (nearOfTop)="onNearOfTop()" (nearOfBottom)="onNearOfBottom()" (pageChanged)="onPageChanged($event)"
-    class="videos" #videoElement
+    class="videos" #videosElement
   >
     <div *ngFor="let videos of videoPages" class="videos-page">
       <my-video-miniature
index 4a220c93d246ce0c2d066686ae59c421f62e72b1..c3543cfaae4b1d6796ff716626ccb6b93c25b5ff 100644 (file)
@@ -15,7 +15,7 @@ import { Video } from './video.model'
 export abstract class AbstractVideoList implements OnInit, OnDestroy {
   private static LINES_PER_PAGE = 3
 
-  @ViewChild('videoElement') videosElement: ElementRef
+  @ViewChild('videosElement') videosElement: ElementRef
   @ViewChild(InfiniteScrollerDirective) infiniteScroller: InfiniteScrollerDirective
 
   pagination: ComponentPagination = {
@@ -183,6 +183,8 @@ 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.pageHeight = this.pagination.itemsPerPage * this.videoHeight
     } else {
       this.videoWidth = this.baseVideoWidth