diff --git a/src/app/gallery/album/album.component.html b/src/app/gallery/album/album.component.html
index fbd9c04..a4b80bc 100644
--- a/src/app/gallery/album/album.component.html
+++ b/src/app/gallery/album/album.component.html
@@ -1,5 +1,5 @@
-
+
= [];
- private thumbnails: Array;
+
+ private leftHeight: number = 0;
+ private middleHeight: number = 0;
+ private rightHeight: number = 0;
+
+ public thumbnailsLeft: Array = [];
+ public thumbnailsMiddle: Array = [];
+ public thumbnailsRight: Array = [];
constructor(private titleService: Title,
private route: ActivatedRoute) {
@@ -24,12 +36,12 @@ export class GalleryComponent implements OnInit {
this.titleService.setTitle('Albums - photos.yvan.hu');
this.route.data.subscribe((data: { albums: Array }) => {
this.albums = data.albums.filter(album => album.isPublic).reverse();
- this.thumbnails = this.initThumbnails();
+ this.initThumbnails();
});
}
- private initThumbnails(): Array {
- return this.albums.map(album => {
+ private initThumbnails() {
+ this.albums.map(album => {
slug: album.slug,
image: this.imageUrl(album),
label: {
@@ -37,36 +49,27 @@ export class GalleryComponent implements OnInit {
extraRight: album.images.length + ' images',
extraLeft: album.date,
},
+ height: album.coverImage.thumbHeight,
+ }).map(thumbnail => {
+ let heights = [this.leftHeight, this.middleHeight, this.rightHeight];
+ let idx = heights.reduce((low, nxt, idx) => nxt < heights[low] ? idx : low, 0);
+ switch(idx) {
+ case IDX_LEFT:
+ this.thumbnailsLeft.push(thumbnail);
+ this.leftHeight += thumbnail.height + THUMB_MARGIN;
+ break;
+ case IDX_MIDDLE:
+ this.thumbnailsMiddle.push(thumbnail);
+ this.middleHeight += thumbnail.height + THUMB_MARGIN;
+ break;
+ case IDX_RIGHT:
+ this.thumbnailsRight.push(thumbnail);
+ this.rightHeight += thumbnail.height + THUMB_MARGIN;
+ break;
+ }
});
}
- get thumbnailsLeft(): Array {
- let thumbs = [];
- for (let i=0;i {
- let thumbs = [];
- for (let i=1;i {
- let thumbs = [];
- for (let i=2;i