Add setting for masonry layout reload on image load progress.

This commit is contained in:
kor 2018-10-31 12:50:38 +13:00
parent ae855de9b2
commit 4873154fe3
3 changed files with 25 additions and 8 deletions

View File

@ -3955,4 +3955,10 @@ WITH LOVE FROM VERY SMALL PLACES
TYPE : music
AUTH : kodedninja
TAGS : ambient, calm
LINK : https://0x22.bandcamp.com/album/with-love-from-very-small-places
LINK : https://0x22.bandcamp.com/album/with-love-from-very-small-places
LIGHTING FIRES POETICS AND SENSATION
PERS : Phil James
AUTH : Phil James
LINK : https://medium.com/@shinestrength/lighting-fires-poetics-and-sensation-991d083e15e9
FILE : 12018-10-31_lightingFires.pdf

View File

@ -4,6 +4,8 @@ const SETTINGS =
STATSNUMTYPE: 10,
WIDEGRIDITEM: true,
USEMASONRY: true,
MASONRYCOMPLETE: true,
MASONRYPROGRESS: true,
GRIDITEMIDBASE: 'item',
SHOWUPPER: true,
SHOWTITLE: true,
@ -16,7 +18,7 @@ const SETTINGS =
SHOWNOTE: true,
SHOWQOTE: true,
SHOWTERM: true,
SHOWDONE: false,
SHOWDONE: true,
SHOWPROG: true,
SHOWIMAG: true,
SHOWFILE: true,

View File

@ -50,13 +50,22 @@ function View()
{
this.msnry.reloadItems();
this.msnry.layout();
}
let imgLoad = imagesLoaded( container );
// When all images finish: redo mansonry layout
imgLoad.on( 'always', function() { parent.msnry.layout(); } );
// As images load one by one: redo masonry layout
// imgLoad.on( 'progress', function() { parent.msnry.layout(); } );
if (SETTINGS.MASONRYCOMPLETE || SETTINGS.MASONRYPROGRESS)
{
let imgLoad = imagesLoaded( container );
if (SETTINGS.MASONRYCOMPLETE)
{
// When all images finish: redo mansonry layout
imgLoad.on( 'always', function() { parent.msnry.layout(); } );
}
if (SETTINGS.MASONRYPROGRESS)
{
// As images load one by one: redo masonry layout
imgLoad.on( 'progress', function() { parent.msnry.layout(); } );
}
}
}
}
this.buildEntry = function(db, key)