From 6eb62c33908025d877a28f1cfbc527c511ae3103 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 22 Aug 2019 13:59:54 +0200 Subject: Fix video rows overflow In discover and account channel videos pages --- client/src/app/shared/misc/screen.service.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'client/src/app/shared') diff --git a/client/src/app/shared/misc/screen.service.ts b/client/src/app/shared/misc/screen.service.ts index af75569d9..220d41d59 100644 --- a/client/src/app/shared/misc/screen.service.ts +++ b/client/src/app/shared/misc/screen.service.ts @@ -22,8 +22,22 @@ export class ScreenService { return 'ontouchstart' in window || navigator.msMaxTouchPoints } + getNumberOfAvailableMiniatures () { + const screenWidth = this.getWindowInnerWidth() + + let numberOfVideos = 1 + + if (screenWidth > 1850) numberOfVideos = 6 + else if (screenWidth > 1600) numberOfVideos = 5 + else if (screenWidth > 1370) numberOfVideos = 4 + else if (screenWidth > 1100) numberOfVideos = 3 + else if (screenWidth > 850) numberOfVideos = 2 + + return numberOfVideos + } + // Cache window inner width, because it's an expensive call - private getWindowInnerWidth () { + getWindowInnerWidth () { if (this.cacheWindowInnerWidthExpired()) this.refreshWindowInnerWidth() return this.windowInnerWidth -- cgit v1.2.3