packery-rails 1.3.1 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cf53791f3035cf569cc5fea200d7a89b59c2b052
4
- data.tar.gz: 74031767c6ae311aecc887e6a11f56ca4362ea84
3
+ metadata.gz: 60c7158f3a6766cb8d77e2b13e6ad9775caaa16f
4
+ data.tar.gz: d524a9f2c2ed4a5f7af7f148be9e97d51920eff3
5
5
  SHA512:
6
- metadata.gz: fc260c55b8ea474dcc2294b5dde8274d985a549722c86e72cb9d287829e8a3cc7144e07180d59fca7484e55ef937533342c8ff83a1647cc46180e1bceb6dcbec
7
- data.tar.gz: b6e3f8195893ebcbafdb06453901d90e93cb69ca05da8aac60b5f11143c1f2e6724cd968f6dbf7ad01ffd242f1301f817d54eff9d0b96b422818ecbf3042de8e
6
+ metadata.gz: 2115e2afc46dc44eb15e888e37eb81f7ba67865081f3d765b638036b6818d38dbde977c79e27ece950550763b5e4be7d76b59d6f9eee421c31a52c2e3d9a3519
7
+ data.tar.gz: 4d6d9e9d76be97dc6c9e6b7637a2ce00230d5cce87e95f55730fe687da2413bec1794d36479b096b382c1d361a65f041c9afd39eb4cac098266004d86b9ce59a
@@ -1,5 +1,5 @@
1
1
  module Packery
2
2
  module Rails
3
- VERSION = '1.3.1'.freeze
3
+ VERSION = '1.3.2'.freeze
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
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,7 +8,7 @@
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 {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: packery-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leonid Beder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-24 00:00:00.000000000 Z
11
+ date: 2015-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties