From 59fab7566f382792dc4f8d575716065e9e294a8d Mon Sep 17 00:00:00 2001 From: David DeSandro Date: Fri, 17 Dec 2010 08:01:11 -0500 Subject: [PATCH] js : cellByRowLayout centered --- src/jquery.molequul.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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;