diff --git a/src/jquery.molequul.js b/src/jquery.molequul.js index dd6a878..fb9ee71 100755 --- a/src/jquery.molequul.js +++ b/src/jquery.molequul.js @@ -621,14 +621,15 @@ }; $.Molequul.prototype._cellsByRowLayout = function( $elems ) { - var instance = this; + var instance = this, + cols = this.cellsByRow.cols; this.cellsByRow.atomsLen = $elems.length; $elems.each( function( i ){ var $this = $(this), - x = ( i % instance.cellsByRow.cols ) * instance.cellsByRow.columnWidth - + instance.posLeft, - y = ~~( i / instance.cellsByRow.cols ) * instance.cellsByRow.rowHeight - + instance.posTop; + x = ( i % cols + 0.5 ) * instance.cellsByRow.columnWidth + - $this.outerWidth(true) / 2 + instance.posLeft, + y = ( ~~( i / cols ) + 0.5 ) * instance.cellsByRow.rowHeight + - $this.outerHeight(true) / 2 + instance.posTop; instance._pushPosition( $this, x, y ); }); return this;