Skip to content

Commit

Permalink
Fix issue kombai#42: data-total-height have "Infinity" value
Browse files Browse the repository at this point in the history
  • Loading branch information
kombai committed Feb 8, 2014
1 parent 800d8eb commit 3c220fc
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions freewall.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@
}

limitCol = Math.floor((width + gutterX) / cellW);
runtime.cellW = (width + gutterX) / limitCol;
runtime.cellW = (width + gutterX) / Math.max(limitCol, 1);
runtime.cellS = runtime.cellW / cellW;
runtime.gutterX = gutterX;
runtime.limitCol = limitCol;
Expand All @@ -341,7 +341,7 @@
}

limitRow = Math.floor((height + gutterY) / cellH);
runtime.cellH = (height + gutterY) / limitRow;
runtime.cellH = (height + gutterY) / Math.max(limitRow, 1);
runtime.cellS = runtime.cellH / cellH;
runtime.gutterY = gutterY;
runtime.limitRow = limitRow;
Expand Down Expand Up @@ -509,14 +509,14 @@

},
setWallSize: function(runtime, container) {
var totalRow = Math.max(1, runtime.totalRow);
var totalCol = Math.max(1, runtime.totalCol);
var totalRow = runtime.totalRow;
var totalCol = runtime.totalCol;
var gutterY = runtime.gutterY;
var gutterX = runtime.gutterX;
var cellH = runtime.cellH;
var cellW = runtime.cellW;
var totalWidth = cellW * totalCol - gutterX;
var totalHeight = cellH * totalRow - gutterY;
var totalWidth = Math.max(0, cellW * totalCol - gutterX);
var totalHeight = Math.max(0, cellH * totalRow - gutterY);

container.attr({
'data-total-col': totalCol,
Expand Down

0 comments on commit 3c220fc

Please sign in to comment.