Sha256: 0b9880f3bd58aeb1526f9aa11afb84159cd4e77c50f9d78109da8e41b49d5817

Contents?: true

Size: 1.5 KB

Versions: 11

Compression:

Stored size: 1.5 KB

Contents

$.Isotope.prototype._getCenteredMasonryColumns = function() {
	this.width = this.element.width();

	var parentWidth = this.element.parent().width();

	// i.e. options.masonry && options.masonry.columnWidth
	var colW = this.options.masonry && this.options.masonry.columnWidth ||
	// or use the size of the first item
	this.$filteredAtoms.outerWidth(true) ||
	// if there's no items, use size of container
	parentWidth;

	var cols = Math.floor( parentWidth / colW );
	cols = Math.max( cols, 1 );

	// i.e. this.masonry.cols = ....
	this.masonry.cols = cols;
	// i.e. this.masonry.columnWidth = ...
	this.masonry.columnWidth = colW;
};

$.Isotope.prototype._masonryReset = function() {
	// layout-specific props
	this.masonry = {};
	// FIXME shouldn't have to call this again
	this._getCenteredMasonryColumns();
	var i = this.masonry.cols;
	this.masonry.colYs = [];
	while (i--) {
		this.masonry.colYs.push( 0 );
	}
};

$.Isotope.prototype._masonryResizeChanged = function() {
	var prevColCount = this.masonry.cols;
	// get updated colCount
	this._getCenteredMasonryColumns();
	return ( this.masonry.cols !== prevColCount );
};

$.Isotope.prototype._masonryGetContainerSize = function() {
	var unusedCols = 0,
	i = this.masonry.cols;
	// count unused columns
	while ( --i ) {
		if ( this.masonry.colYs[i] !== 0 ) {
			break;
		}
		unusedCols++;
	}

	return {
		height : Math.max.apply( Math, this.masonry.colYs ),
		// fit container to columns that have been used;
		width : (this.masonry.cols - unusedCols) * this.masonry.columnWidth
	};
};

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
bonethug-0.0.17 skel/project_types/silverstripe3/public/abc/javascript/isotope-centered-masonry.js
bonethug-0.0.16 skel/project_types/silverstripe3/public/abc/javascript/isotope-centered-masonry.js
bonethug-0.0.15 skel/project_types/silverstripe3/public/abc/javascript/isotope-centered-masonry.js
bonethug-0.0.14 skel/project_types/silverstripe3/public/abc/javascript/isotope-centered-masonry.js
bonethug-0.0.13 skel/project_types/silverstripe3/public/abc/javascript/isotope-centered-masonry.js
bonethug-0.0.12 skel/project_types/silverstripe3/public/abc/javascript/isotope-centered-masonry.js
bonethug-0.0.11 skel/project_types/silverstripe3/public/abc/javascript/isotope-centered-masonry.js
bonethug-0.0.10 skel/project_types/silverstripe3/public/abc/javascript/isotope-centered-masonry.js
bonethug-0.0.7 skel/project_types/silverstripe3/public/abc/javascript/isotope-centered-masonry.js
bonethug-0.0.6 skel/project_types/silverstripe3/public/abc/javascript/isotope-centered-masonry.js
bonethug-0.0.5 skel/project_types/silverstripe3/public/abc/javascript/isotope-centered-masonry.js