選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 

45 行
888 B

  1. /*globals Outlayer */
  2. ( function() {
  3. 'use strict';
  4. var FitRows = window.FitRows = Outlayer.create('fitRows');
  5. var proto = FitRows.prototype;
  6. proto._resetLayout = function() {
  7. this.getSize();
  8. this.x = 0;
  9. this.y = 0;
  10. this.maxY = 0;
  11. this._getMeasurement( 'gutter', 'outerWidth' );
  12. };
  13. proto._getItemLayoutPosition = function( item ) {
  14. item.getSize();
  15. var itemWidth = item.size.outerWidth + this.gutter;
  16. // if this element cannot fit in the current row
  17. var containerWidth = this.size.innerWidth + this.gutter;
  18. if ( this.x !== 0 && itemWidth + this.x > containerWidth ) {
  19. this.x = 0;
  20. this.y = this.maxY;
  21. }
  22. var position = {
  23. x: this.x,
  24. y: this.y
  25. };
  26. this.maxY = Math.max( this.maxY, this.y + item.size.outerHeight );
  27. this.x += itemWidth;
  28. return position;
  29. };
  30. proto._getContainerSize = function() {
  31. return { height: this.maxY };
  32. };
  33. })();