aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/misc/screen.service.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-08-22 14:46:47 +0200
committerChocobozzz <me@florianbigard.com>2019-08-22 14:46:47 +0200
commitd5c8932a601c1854db0a2e399ccaf26e17385f1a (patch)
tree8c38f9d7772c6a2d22dbeb84a7c4de6aaf345aeb /client/src/app/shared/misc/screen.service.ts
parent2a8ae7595c1b7853c47955b4b9ecb4a7f7a68fc0 (diff)
parent820546916cad3ae4cc51eab408aef7bbaff3632f (diff)
downloadPeerTube-d5c8932a601c1854db0a2e399ccaf26e17385f1a.tar.gz
PeerTube-d5c8932a601c1854db0a2e399ccaf26e17385f1a.tar.zst
PeerTube-d5c8932a601c1854db0a2e399ccaf26e17385f1a.zip
Merge branch 'release/1.4.0' into develop
Diffstat (limited to 'client/src/app/shared/misc/screen.service.ts')
-rw-r--r--client/src/app/shared/misc/screen.service.ts16
1 files changed, 15 insertions, 1 deletions
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 {
22 return 'ontouchstart' in window || navigator.msMaxTouchPoints 22 return 'ontouchstart' in window || navigator.msMaxTouchPoints
23 } 23 }
24 24
25 getNumberOfAvailableMiniatures () {
26 const screenWidth = this.getWindowInnerWidth()
27
28 let numberOfVideos = 1
29
30 if (screenWidth > 1850) numberOfVideos = 6
31 else if (screenWidth > 1600) numberOfVideos = 5
32 else if (screenWidth > 1370) numberOfVideos = 4
33 else if (screenWidth > 1100) numberOfVideos = 3
34 else if (screenWidth > 850) numberOfVideos = 2
35
36 return numberOfVideos
37 }
38
25 // Cache window inner width, because it's an expensive call 39 // Cache window inner width, because it's an expensive call
26 private getWindowInnerWidth () { 40 getWindowInnerWidth () {
27 if (this.cacheWindowInnerWidthExpired()) this.refreshWindowInnerWidth() 41 if (this.cacheWindowInnerWidthExpired()) this.refreshWindowInnerWidth()
28 42
29 return this.windowInnerWidth 43 return this.windowInnerWidth