Browse Source

js : Use $.extend for cellByRow layout

pull/14/head
David DeSandro 14 years ago
parent
commit
b801948bb0
  1. 21
      src/jquery.molequul.js

21
src/jquery.molequul.js

@ -613,14 +613,16 @@
// ====================== cellsByRow ====================== // ====================== cellsByRow ======================
$.Molequul.prototype._cellsByRowReset = function() { $.extend( $.Molequul.prototype, {
_cellsByRowReset : function() {
this.cellsByRow = {}; this.cellsByRow = {};
this._getCols('cellsByRow'); this._getCols('cellsByRow');
this.cellsByRow.rowHeight = this.options.cellsByRow.rowHeight || this.$allAtoms.outerHeight(true); this.cellsByRow.rowHeight = this.options.cellsByRow.rowHeight || this.$allAtoms.outerHeight(true);
return this; return this;
}; },
$.Molequul.prototype._cellsByRowLayout = function( $elems ) { _cellsByRowLayout : function( $elems ) {
var instance = this, var instance = this,
cols = this.cellsByRow.cols; cols = this.cellsByRow.cols;
this.cellsByRow.atomsLen = $elems.length; this.cellsByRow.atomsLen = $elems.length;
@ -633,13 +635,13 @@
instance._pushPosition( $this, x, y ); instance._pushPosition( $this, x, y );
}); });
return this; return this;
}; },
$.Molequul.prototype._cellsByRowGetContainerSize = function() { _cellsByRowGetContainerSize : function() {
return { height : Math.ceil( this.cellsByRow.atomsLen / this.cellsByRow.cols ) * this.cellsByRow.rowHeight + this.posTop }; return { height : Math.ceil( this.cellsByRow.atomsLen / this.cellsByRow.cols ) * this.cellsByRow.rowHeight + this.posTop };
}; },
$.Molequul.prototype._cellsByRowResize = function() { _cellsByRowResize : function() {
var prevCols = this.cellsByRow.cols; var prevCols = this.cellsByRow.cols;
this._getCols('cellsByRow'); this._getCols('cellsByRow');
@ -648,7 +650,10 @@
this.reLayout(); this.reLayout();
} }
return this; return this;
}; }
});

Loading…
Cancel
Save