ember-masonry-grid icon indicating copy to clipboard operation
ember-masonry-grid copied to clipboard

option to ignore `imagesLoaded`

Open Redsandro opened this issue 9 years ago • 2 comments
trafficstars

imagesLoaded can quickly add a couple of seconds to aligning your lists. In some cases it is not necessary.

I'd like to see an option specified to the helper (that defaults to true for backwards compatibility reasons) to skip waiting for images to load. E.g.:

{{#masonry-grid
    items=model
    customLayout=true
    imagesLoaded=false
    onLayoutComplete=(action 'onLayoutComplete')
    as |item index grid|}}

Redsandro avatar Aug 03 '16 10:08 Redsandro

To confirm, imagesLoaded is not actually part of this addon at the moment and has to be used separately (as per advise here http://masonry.desandro.com/layout.html#imagesloaded)?

If it is, what is the current default behaviour?

carrotcomputer avatar Aug 10 '16 19:08 carrotcomputer

@sparkrevolutions

To confirm, imagesLoaded is not actually part of this addon at the moment and has to be used separately

Well, it waits for all images to load before doing the grid spacing. How do you mean it's not actually part of this addon? See:

https://github.com/gmurphey/ember-masonry-grid/blob/df040b2065749e73cf6692536dd4b34dbd1f291e/addon/components/masonry-grid/component.js#L77

    Ember.run.scheduleOnce('afterRender', this, () => {
      imagesLoaded(get(this, 'element'), () => {
        if (masonry) {
          masonry.reloadItems();
        } else {

The noticeable consequence in my case is that every item is drawn on top of each other and only once every image is loaded do the items pop into place. This looks very hacky to the user, so we need to hide the content until the masonry magic (and thus the loading of images) is finished.

Redsandro avatar Oct 02 '16 14:10 Redsandro