Skip to content

Commit 3b0883c

Browse files
committed
👷‍♀️ build v4.2.2; 🛠 use float values for position
⬆️ update dependencies + outlayer v2.1.1. #795 + fizzy-ui-utils v2.0.7 + get-size v2.0.3
1 parent 31113c7 commit 3b0883c

File tree

4 files changed

+49
-47
lines changed

4 files changed

+49
-47
lines changed

dist/masonry.pkgd.js

Lines changed: 45 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* Masonry PACKAGED v4.2.1
2+
* Masonry PACKAGED v4.2.2
33
* Cascading grid layout library
44
* https://masonry.desandro.com
55
* MIT License
@@ -264,22 +264,19 @@ return EvEmitter;
264264
}));
265265

266266
/*!
267-
* getSize v2.0.2
267+
* getSize v2.0.3
268268
* measure size of elements
269269
* MIT license
270270
*/
271271

272-
/*jshint browser: true, strict: true, undef: true, unused: true */
273-
/*global define: false, module: false, console: false */
272+
/* jshint browser: true, strict: true, undef: true, unused: true */
273+
/* globals console: false */
274274

275275
( function( window, factory ) {
276-
'use strict';
277-
276+
/* jshint strict: false */ /* globals define, module */
278277
if ( typeof define == 'function' && define.amd ) {
279278
// AMD
280-
define( 'get-size/get-size',[],function() {
281-
return factory();
282-
});
279+
define( 'get-size/get-size',factory );
283280
} else if ( typeof module == 'object' && module.exports ) {
284281
// CommonJS
285282
module.exports = factory();
@@ -354,7 +351,7 @@ function getStyle( elem ) {
354351
if ( !style ) {
355352
logError( 'Style returned ' + style +
356353
'. Are you running this code in a hidden iframe on Firefox? ' +
357-
'See http://bit.ly/getsizebug1' );
354+
'See https://bit.ly/getsizebug1' );
358355
}
359356
return style;
360357
}
@@ -380,8 +377,8 @@ function setup() {
380377
// -------------------------- box sizing -------------------------- //
381378

382379
/**
383-
* WebKit measures the outer-width on style.width on border-box elems
384-
* IE & Firefox<29 measures the inner-width
380+
* Chrome & Safari measure the outer-width on style.width on border-box elems
381+
* IE11 & Firefox<29 measures the inner-width
385382
*/
386383
var div = document.createElement('div');
387384
div.style.width = '200px';
@@ -393,10 +390,11 @@ function setup() {
393390
var body = document.body || document.documentElement;
394391
body.appendChild( div );
395392
var style = getStyle( div );
393+
// round value for browser zoom. desandro/masonry#928
394+
isBoxSizeOuter = Math.round( getStyleSize( style.width ) ) == 200;
395+
getSize.isBoxSizeOuter = isBoxSizeOuter;
396396

397-
getSize.isBoxSizeOuter = isBoxSizeOuter = getStyleSize( style.width ) == 200;
398397
body.removeChild( div );
399-
400398
}
401399

402400
// -------------------------- getSize -------------------------- //
@@ -528,7 +526,7 @@ return getSize;
528526
}));
529527

530528
/**
531-
* Fizzy UI utils v2.0.5
529+
* Fizzy UI utils v2.0.7
532530
* MIT license
533531
*/
534532

@@ -583,23 +581,27 @@ utils.modulo = function( num, div ) {
583581

584582
// ----- makeArray ----- //
585583

584+
var arraySlice = Array.prototype.slice;
585+
586586
// turn element or nodeList into an array
587587
utils.makeArray = function( obj ) {
588-
var ary = [];
589588
if ( Array.isArray( obj ) ) {
590589
// use object if already an array
591-
ary = obj;
592-
} else if ( obj && typeof obj == 'object' &&
593-
typeof obj.length == 'number' ) {
590+
return obj;
591+
}
592+
// return empty array if undefined or null. #6
593+
if ( obj === null || obj === undefined ) {
594+
return [];
595+
}
596+
597+
var isArrayLike = typeof obj == 'object' && typeof obj.length == 'number';
598+
if ( isArrayLike ) {
594599
// convert nodeList to array
595-
for ( var i=0; i < obj.length; i++ ) {
596-
ary.push( obj[i] );
597-
}
598-
} else {
599-
// array of single index
600-
ary.push( obj );
600+
return arraySlice.call( obj );
601601
}
602-
return ary;
602+
603+
// array of single index
604+
return [ obj ];
603605
};
604606

605607
// ----- removeFrom ----- //
@@ -678,22 +680,21 @@ utils.filterFindElements = function( elems, selector ) {
678680
// ----- debounceMethod ----- //
679681

680682
utils.debounceMethod = function( _class, methodName, threshold ) {
683+
threshold = threshold || 100;
681684
// original method
682685
var method = _class.prototype[ methodName ];
683686
var timeoutName = methodName + 'Timeout';
684687

685688
_class.prototype[ methodName ] = function() {
686689
var timeout = this[ timeoutName ];
687-
if ( timeout ) {
688-
clearTimeout( timeout );
689-
}
690-
var args = arguments;
690+
clearTimeout( timeout );
691691

692+
var args = arguments;
692693
var _this = this;
693694
this[ timeoutName ] = setTimeout( function() {
694695
method.apply( _this, args );
695696
delete _this[ timeoutName ];
696-
}, threshold || 100 );
697+
}, threshold );
697698
};
698699
};
699700

@@ -901,13 +902,16 @@ proto.getPosition = function() {
901902
var isOriginTop = this.layout._getOption('originTop');
902903
var xValue = style[ isOriginLeft ? 'left' : 'right' ];
903904
var yValue = style[ isOriginTop ? 'top' : 'bottom' ];
905+
var x = parseFloat( xValue );
906+
var y = parseFloat( yValue );
904907
// convert percent to pixels
905908
var layoutSize = this.layout.size;
906-
var x = xValue.indexOf('%') != -1 ?
907-
( parseFloat( xValue ) / 100 ) * layoutSize.width : parseInt( xValue, 10 );
908-
var y = yValue.indexOf('%') != -1 ?
909-
( parseFloat( yValue ) / 100 ) * layoutSize.height : parseInt( yValue, 10 );
910-
909+
if ( xValue.indexOf('%') != -1 ) {
910+
x = ( x / 100 ) * layoutSize.width;
911+
}
912+
if ( yValue.indexOf('%') != -1 ) {
913+
y = ( y / 100 ) * layoutSize.height;
914+
}
911915
// clean up 'auto' or other non-integer values
912916
x = isNaN( x ) ? 0 : x;
913917
y = isNaN( y ) ? 0 : y;
@@ -970,9 +974,7 @@ proto._transitionTo = function( x, y ) {
970974
var curX = this.position.x;
971975
var curY = this.position.y;
972976

973-
var compareX = parseInt( x, 10 );
974-
var compareY = parseInt( y, 10 );
975-
var didNotMove = compareX === this.position.x && compareY === this.position.y;
977+
var didNotMove = x == this.position.x && y == this.position.y;
976978

977979
// save end position
978980
this.setPosition( x, y );
@@ -1015,8 +1017,8 @@ proto.goTo = function( x, y ) {
10151017
proto.moveTo = proto._transitionTo;
10161018

10171019
proto.setPosition = function( x, y ) {
1018-
this.position.x = parseInt( x, 10 );
1019-
this.position.y = parseInt( y, 10 );
1020+
this.position.x = parseFloat( x );
1021+
this.position.y = parseFloat( y );
10201022
};
10211023

10221024
// ----- transition ----- //
@@ -1321,7 +1323,7 @@ return Item;
13211323
}));
13221324

13231325
/*!
1324-
* Outlayer v2.1.0
1326+
* Outlayer v2.1.1
13251327
* the brains and guts of a layout library
13261328
* MIT license
13271329
*/
@@ -2261,7 +2263,7 @@ return Outlayer;
22612263
}));
22622264

22632265
/*!
2264-
* Masonry v4.2.1
2266+
* Masonry v4.2.2
22652267
* Cascading grid layout library
22662268
* https://masonry.desandro.com
22672269
* MIT License

0 commit comments

Comments
 (0)