Browse Source

add Isotope._modeMethod

pull/563/head
David DeSandro 12 years ago
parent
commit
cb8aaeb589
  1. 24
      isotope.js
  2. 18
      layout-mode.js

24
isotope.js

@ -187,19 +187,31 @@ function isotopeDefinition( Outlayer, getSize, matchesSelector, Item ) {
// -------------------------- methods -------------------------- //
Isotope.prototype._resetLayout = function() {
this._mode()._resetLayout();
this._modeMethod( '_resetLayout', arguments );
};
Isotope.prototype._getItemLayoutPosition = function( item ) {
return this._mode()._getItemLayoutPosition( item );
Isotope.prototype._getItemLayoutPosition = function( /* item */) {
return this._modeMethod( '_getItemLayoutPosition', arguments );
};
Isotope.prototype._manageStamp = function( stamp ) {
this._mode()._manageStamp( stamp );
Isotope.prototype._manageStamp = function(/* stamp */) {
this._modeMethod( '_manageStamp', arguments );
};
Isotope.prototype._getContainerSize = function() {
return this._mode()._getContainerSize();
return this._modeMethod( '_getContainerSize', arguments );
};
Isotope.prototype._modeMethod = function( methodName, args ) {
var mode = this._mode();
var modeMethod = mode[ methodName ];
// use mode's method, if there
if ( modeMethod ) {
return modeMethod.apply( mode, args );
} else {
// otherwise, default to Outlayer prototype
return Outlayer.prototype[ methodName ].apply( this, args );
}
};
return Isotope;

18
layout-mode.js

@ -5,7 +5,6 @@
// -------------------------- -------------------------- //
var Isotope = window.Isotope;
var Outlayer = window.Outlayer;
function LayoutMode( isotope ) {
this.isotope = isotope;
@ -13,23 +12,6 @@ function LayoutMode( isotope ) {
this.options = isotope && isotope.options[ this.namespace ];
}
// default methods just defer to Isotope
LayoutMode.prototype._resetLayout = function() {
Outlayer.prototype._resetLayout.apply( this.isotope, arguments );
};
LayoutMode.prototype._getItemLayoutPosition = function() {
return Outlayer.prototype._getItemLayoutPosition.apply( this.isotope, arguments );
};
LayoutMode.prototype._manageStamp = function() {
Outlayer.prototype._manageStamp.apply( this.isotope, arguments );
};
LayoutMode.prototype._getContainerSize = function() {
return Outlayer.prototype._getContainerSize.apply( this.isotope, arguments );
};
// -------------------------- create -------------------------- //
LayoutMode.create = function( namespace, options ) {

Loading…
Cancel
Save