Skip to content

Commit baca3ce

Browse files
committed
Fix an issue where hidden items would still be calculated in the grid, Fixes #48
1 parent f384299 commit baca3ce

File tree

6 files changed

+12
-4
lines changed

6 files changed

+12
-4
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "macy",
3-
"version": "2.3.1",
3+
"version": "2.3.2",
44
"homepage": "http://macyjs.com/",
55
"author": {
66
"name": "Big Bite Creative",

dist/macy.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "macy",
33
"description": "Macy is a lightweight, dependency free, masonry layout library",
4-
"version": "2.3.1",
4+
"version": "2.3.2",
55
"author": {
66
"name": "Big Bite Creative",
77
"url": "http://bigbitecreative.com",

rollup.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ let buildObj = {
66
entry: 'src/macy.js',
77
format: 'umd',
88
moduleName: 'Macy',
9-
banner: '/* Macy.js - v2.3.1 */',
9+
banner: '/* Macy.js - v2.3.2 */',
1010
plugins: [
1111
eslint(),
1212
babel(),

src/macy.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ import scopeShim from './helpers/scopeshim';
66

77
import foreach from './helpers/foreach';
88

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

1014
const defaults = {
1115
columns: 4,

src/modules/calculate.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ import foreach from '../helpers/foreach';
1111
*/
1212
const calculate = (ctx, refresh = false, loaded = true) => {
1313
let children = refresh ? ctx.container.children : $e(':scope > *:not([data-macy-complete="1"])', ctx.container);
14+
15+
// Filter out hidden children.
16+
children = Array.from(children).filter(child => child.offsetParent !== null);
17+
1418
let eleWidth = getWidths(ctx.options);
1519

1620
foreach(children, (child) => {

0 commit comments

Comments
 (0)