Browse Source

js : add cellByRowResize

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

24
src/jquery.molequul.js

@ -459,8 +459,6 @@
this[ namespace ].cols = Math.floor( this.width / this[ namespace ].columnWidth ) ; this[ namespace ].cols = Math.floor( this.width / this[ namespace ].columnWidth ) ;
this[ namespace ].cols = Math.max( this[ namespace ].cols, 1 ); this[ namespace ].cols = Math.max( this[ namespace ].cols, 1 );
console.log( 'cols for ' + namespace, this[ namespace ].cols )
return this; return this;
} }
@ -627,20 +625,30 @@
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 + instance.posLeft, x = ( i % instance.cellsByRow.cols ) * instance.cellsByRow.columnWidth
y = ~~( i / instance.cellsByRow.cols ) * instance.cellsByRow.rowHeight + instance.posTop; + instance.posLeft,
console.log( x, y ) y = ~~( i / instance.cellsByRow.cols ) * instance.cellsByRow.rowHeight
+ instance.posTop;
instance._pushPosition( $this, x, y ); instance._pushPosition( $this, x, y );
}); });
return this;
}; };
$.Molequul.prototype._cellsByRowGetContainerSize = function() { $.Molequul.prototype._cellsByRowGetContainerSize = function() {
console.log( Math.ceil( this.cellsByRow.atomsLen / this.cellsByRow.cols ) )
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() {
var prevCols = this.cellsByRow.cols;
this._getCols('cellsByRow');
// if column count has changed, do a new column cound
if ( this.cellsByRow.cols !== prevCols ) {
this.reLayout();
}
return this;
};
})( jQuery ); })( jQuery );
Loading…
Cancel
Save