From 49a8700e8112498809af8fad04a217a377c91844 Mon Sep 17 00:00:00 2001 From: Greta Doci Date: Tue, 20 Aug 2019 14:09:58 +0200 Subject: [PATCH] apply fit() to all rows, even when they are not complete ref #16576 Signed-off-by: Greta Doci --- js/galleryalbum.js | 3 ++- js/galleryrow.js | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/js/galleryalbum.js b/js/galleryalbum.js index 05a50815b..0d8afcd01 100644 --- a/js/galleryalbum.js +++ b/js/galleryalbum.js @@ -48,6 +48,7 @@ this.domDef = null; this.loader = null; this.preloadOffset = 0; + this.defaultRatio = 1; }; Album.prototype = { @@ -171,7 +172,7 @@ if (more && album.viewedItems < images.length) { return addRowElements(album, row, images); } - row.fit(); + album.defaultRatio = row.fit(album.defaultRatio); def.resolve(row); }); }; diff --git a/js/galleryrow.js b/js/galleryrow.js index 12467ac2e..e51502f47 100644 --- a/js/galleryrow.js +++ b/js/galleryrow.js @@ -123,8 +123,8 @@ /** * Resizes the row once it's full */ - fit: function () { - var scaleRatio = (this.width > this.targetWidth) ? this.targetWidth / this.width : 1; + fit: function (defaultRatio) { + var scaleRatio = (this.width > this.targetWidth) ? this.targetWidth / this.width: defaultRatio; // This animates the elements when the window is resized var targetHeight = 4 + (this.targetHeight * scaleRatio); @@ -149,6 +149,8 @@ // Restore the rows to their normal opacity. This happens immediately with rows // containing albums only this.domDef.css('opacity', 1); + + return scaleRatio; }, /**