1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00

Improve mobile directory grid layout

This commit is contained in:
Tuur Lievens 2020-09-13 13:32:46 +02:00
parent f1d9fa0933
commit e11b5cc728

View File

@ -19,9 +19,13 @@ export class DirectoriesComponent implements OnChanges {
} }
private updateSize() { private updateSize() {
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 size = 220 + 5;
const containerWidth = this.container.nativeElement.parentElement.clientWidth; const containerWidth = this.container.nativeElement.parentElement.clientWidth;
this.size = (containerWidth / Math.round((containerWidth / size))) - 5; this.size = (containerWidth / Math.round((containerWidth / size))) - 5;
} }
}
} }