Browse Source

js : cellByRowLayout centered

pull/14/head
David DeSandro 14 years ago
parent
commit
59fab7566f
  1. 11
      src/jquery.molequul.js

11
src/jquery.molequul.js

@ -621,14 +621,15 @@
}; };
$.Molequul.prototype._cellsByRowLayout = function( $elems ) { $.Molequul.prototype._cellsByRowLayout = function( $elems ) {
var instance = this; var instance = this,
cols = this.cellsByRow.cols;
this.cellsByRow.atomsLen = $elems.length; this.cellsByRow.atomsLen = $elems.length;
$elems.each( function( i ){ $elems.each( function( i ){
var $this = $(this), var $this = $(this),
x = ( i % instance.cellsByRow.cols ) * instance.cellsByRow.columnWidth x = ( i % cols + 0.5 ) * instance.cellsByRow.columnWidth
+ instance.posLeft, - $this.outerWidth(true) / 2 + instance.posLeft,
y = ~~( i / instance.cellsByRow.cols ) * instance.cellsByRow.rowHeight y = ( ~~( i / cols ) + 0.5 ) * instance.cellsByRow.rowHeight
+ instance.posTop; - $this.outerHeight(true) / 2 + instance.posTop;
instance._pushPosition( $this, x, y ); instance._pushPosition( $this, x, y );
}); });
return this; return this;

Loading…
Cancel
Save