Skip to content

Commit

Permalink
Fix an issue where hidden items would still be calculated in the grid,
Browse files Browse the repository at this point in the history
…Fixes #48
  • Loading branch information
jrmd committed Jan 23, 2019
1 parent f384299 commit baca3ce
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "macy",
"version": "2.3.1",
"version": "2.3.2",
"homepage": "http://macyjs.com/",
"author": {
"name": "Big Bite Creative",
Expand Down
2 changes: 1 addition & 1 deletion dist/macy.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "macy",
"description": "Macy is a lightweight, dependency free, masonry layout library",
"version": "2.3.1",
"version": "2.3.2",
"author": {
"name": "Big Bite Creative",
"url": "http://bigbitecreative.com",
Expand Down
2 changes: 1 addition & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ let buildObj = {
entry: 'src/macy.js',
format: 'umd',
moduleName: 'Macy',
banner: '/* Macy.js - v2.3.1 */',
banner: '/* Macy.js - v2.3.2 */',
plugins: [
eslint(),
babel(),
Expand Down
4 changes: 4 additions & 0 deletions src/macy.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import scopeShim from './helpers/scopeshim';

import foreach from './helpers/foreach';

if (!Array.from) {
Array.from=n=>{let i=0,a=[];for (;i<n.length;)a.push(n[i++]);return a;}
}


const defaults = {
columns: 4,
Expand Down
4 changes: 4 additions & 0 deletions src/modules/calculate.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ import foreach from '../helpers/foreach';
*/
const calculate = (ctx, refresh = false, loaded = true) => {
let children = refresh ? ctx.container.children : $e(':scope > *:not([data-macy-complete="1"])', ctx.container);

// Filter out hidden children.
children = Array.from(children).filter(child => child.offsetParent !== null);

let eleWidth = getWidths(ctx.options);

foreach(children, (child) => {
Expand Down

0 comments on commit baca3ce

Please sign in to comment.