1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2024-12-10 11:10:35 +02:00

Merge pull request #181 from tuur29/feature/mobile-directory-grid-layout

Improve mobile directory grid layout
This commit is contained in:
Patrik J. Braun 2020-09-13 14:55:10 +02:00 committed by GitHub
commit 3c404c0cd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,9 +19,13 @@ export class DirectoriesComponent implements OnChanges {
}
private updateSize() {
const size = 220 + 5;
const containerWidth = this.container.nativeElement.parentElement.clientWidth;
this.size = (containerWidth / Math.round((containerWidth / size))) - 5;
if (window.innerWidth < window.innerHeight) {
// On portrait mode, show 2 directories side by side with some padding
this.size = Math.round(window.innerWidth / 2) - 25;
} else {
const size = 220 + 5;
const containerWidth = this.container.nativeElement.parentElement.clientWidth;
this.size = (containerWidth / Math.round((containerWidth / size))) - 5;
}
}
}