1
1
/*!
2
- * Packery PACKAGED v1.3.1
2
+ * Packery PACKAGED v1.3.2
3
3
* bin-packing layout library
4
4
* http://packery.metafizzy.co
5
5
*
8
8
*
9
9
* Non-commercial use is licensed under the GPL v3 License
10
10
*
11
- * Copyright 2014 Metafizzy
11
+ * Copyright 2015 Metafizzy
12
12
*/
13
13
14
14
/**
@@ -545,7 +545,7 @@ if ( typeof define === 'function' && define.amd ) {
545
545
} ) ( window ) ;
546
546
547
547
/*!
548
- * eventie v1.0.5
548
+ * eventie v1.0.6
549
549
* event binding helper
550
550
* eventie.bind( elem, 'click', myFn )
551
551
* eventie.unbind( elem, 'click', myFn )
@@ -625,7 +625,7 @@ if ( typeof define === 'function' && define.amd ) {
625
625
window . eventie = eventie ;
626
626
}
627
627
628
- } ) ( this ) ;
628
+ } ) ( window ) ;
629
629
630
630
/*!
631
631
* docReady v1.0.4
@@ -3357,7 +3357,7 @@ if ( typeof define === 'function' && define.amd ) {
3357
3357
} ) ( window ) ;
3358
3358
3359
3359
/*!
3360
- * Packery v1.3.1
3360
+ * Packery v1.3.2
3361
3361
* bin-packing layout library
3362
3362
* http://packery.metafizzy.co
3363
3363
*
@@ -3366,18 +3366,25 @@ if ( typeof define === 'function' && define.amd ) {
3366
3366
*
3367
3367
* Non-commercial use is licensed under the GPL v3 License
3368
3368
*
3369
- * Copyright 2014 Metafizzy
3369
+ * Copyright 2015 Metafizzy
3370
3370
*/
3371
3371
3372
3372
( function ( window ) {
3373
3373
3374
3374
3375
3375
3376
- // -------------------------- Packery -------------------------- //
3377
-
3378
3376
// used for AMD definition and requires
3379
3377
function packeryDefinition ( classie , getSize , Outlayer , Rect , Packer , Item ) {
3380
3378
3379
+ // ----- Rect ----- //
3380
+
3381
+ // allow for pixel rounding errors IE8-IE11 & Firefox; #227
3382
+ Rect . prototype . canFit = function ( rect ) {
3383
+ return this . width >= rect . width - 1 && this . height >= rect . height - 1 ;
3384
+ } ;
3385
+
3386
+ // -------------------------- Packery -------------------------- //
3387
+
3381
3388
// create an Outlayer layout class
3382
3389
var Packery = Outlayer . create ( 'packery' ) ;
3383
3390
Packery . Item = Item ;
@@ -3500,16 +3507,33 @@ Packery.prototype._setRectSize = function( elem, rect ) {
3500
3507
// size for columnWidth and rowHeight, if available
3501
3508
// only check if size is non-zero, #177
3502
3509
if ( w || h ) {
3503
- var colW = this . columnWidth + this . gutter ;
3504
- var rowH = this . rowHeight + this . gutter ;
3505
- w = this . columnWidth ? Math . ceil ( w / colW ) * colW : w + this . gutter ;
3506
- h = this . rowHeight ? Math . ceil ( h / rowH ) * rowH : h + this . gutter ;
3510
+ w = this . _applyGridGutter ( w , this . columnWidth ) ;
3511
+ h = this . _applyGridGutter ( h , this . rowHeight ) ;
3507
3512
}
3508
3513
// rect must fit in packer
3509
3514
rect . width = Math . min ( w , this . packer . width ) ;
3510
3515
rect . height = Math . min ( h , this . packer . height ) ;
3511
3516
} ;
3512
3517
3518
+ /**
3519
+ * fits item to columnWidth/rowHeight and adds gutter
3520
+ * @param {Number } measurement - item width or height
3521
+ * @param {Number } gridSize - columnWidth or rowHeight
3522
+ * @returns measurement
3523
+ */
3524
+ Packery . prototype . _applyGridGutter = function ( measurement , gridSize ) {
3525
+ // just add gutter if no gridSize
3526
+ if ( ! gridSize ) {
3527
+ return measurement + this . gutter ;
3528
+ }
3529
+ gridSize += this . gutter ;
3530
+ // fit item to columnWidth/rowHeight
3531
+ var remainder = measurement % gridSize ;
3532
+ var mathMethod = remainder && remainder < 1 ? 'round' : 'ceil' ;
3533
+ measurement = Math [ mathMethod ] ( measurement / gridSize ) * gridSize ;
3534
+ return measurement ;
3535
+ } ;
3536
+
3513
3537
Packery . prototype . _getContainerSize = function ( ) {
3514
3538
if ( this . options . isHorizontal ) {
3515
3539
return {
0 commit comments