apply fit() to all rows, even when they are not complete ref #16576

Signed-off-by: Greta Doci <gretadoci@gmail.com>
This commit is contained in:
Greta Doci 2019-08-20 14:09:58 +02:00
parent 30eb000aa6
commit 49a8700e81
2 changed files with 6 additions and 3 deletions

View File

@ -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);
});
};

View File

@ -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;
},
/**