diff options
author | Greta Doci <gretadoci@gmail.com> | 2019-08-20 15:09:58 +0300 |
---|---|---|
committer | Greta Doci <gretadoci@gmail.com> | 2019-08-20 15:09:58 +0300 |
commit | 49a8700e8112498809af8fad04a217a377c91844 (patch) | |
tree | ab4662906df4076a87c6763b9996d77a17319f15 | |
parent | 30eb000aa60832e7c699b0f8377ac0451a15dd00 (diff) |
apply fit() to all rows, even when they are not complete ref #16576bugfix/16576/gallery_misalignment_of_folder_previews
Signed-off-by: Greta Doci <gretadoci@gmail.com>
-rw-r--r-- | js/galleryalbum.js | 3 | ||||
-rw-r--r-- | js/galleryrow.js | 6 |
2 files changed, 6 insertions, 3 deletions
diff --git a/js/galleryalbum.js b/js/galleryalbum.js index 05a50815..0d8afcd0 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 12467ac2..e51502f4 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; }, /** |