You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
( function( window ) {
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
function fitRowsDefinition( layoutMode ) {
|
|
|
|
|
|
|
|
var FitRows = layoutMode.create( 'fitRows', {
|
|
|
|
foo: 'bar'
|
|
|
|
});
|
|
|
|
|
|
|
|
FitRows.prototype._resetLayout = function() {
|
|
|
|
this.x = 0;
|
|
|
|
this.y = 0;
|
|
|
|
this.maxY = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
FitRows.prototype._getItemLayoutPosition = function( item ) {
|
|
|
|
item.getSize();
|
|
|
|
|
|
|
|
// if this element cannot fit in the current row
|
|
|
|
if ( this.x !== 0 && item.size.outerWidth + this.x > this.isotope.size.innerWidth ) {
|
|
|
|
this.x = 0;
|
|
|
|
this.y = this.maxY;
|
|
|
|
}
|
|
|
|
|
|
|
|
var position = {
|
|
|
|
x: this.x,
|
|
|
|
y: this.y
|
|
|
|
};
|
|
|
|
|
|
|
|
this.maxY = Math.max( this.maxY, this.y + item.size.outerHeight );
|
|
|
|
this.x += item.size.outerWidth;
|
|
|
|
|
|
|
|
return position;
|
|
|
|
};
|
|
|
|
|
|
|
|
FitRows.prototype._getContainerSize = function() {
|
|
|
|
return { height: this.maxY };
|
|
|
|
};
|
|
|
|
|
|
|
|
return FitRows;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( typeof define === 'function' && define.amd ) {
|
|
|
|
// AMD
|
|
|
|
define( [
|
|
|
|
'../layout-mode'
|
|
|
|
],
|
|
|
|
fitRowsDefinition );
|
|
|
|
} else {
|
|
|
|
// browser global
|
|
|
|
fitRowsDefinition(
|
|
|
|
window.Isotope.layoutMode
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
})( window );
|