From 64ef3810dbc6470feb314d71bca917cab7a213e0 Mon Sep 17 00:00:00 2001 From: Steve Rice Date: Thu, 29 Aug 2013 10:32:49 -0700 Subject: [PATCH] Compensate for scrollbar width across all asterisked columns instead of just the last one --- src/classes/grid.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/classes/grid.js b/src/classes/grid.js index 3a0dd241..79b5b137 100644 --- a/src/classes/grid.js +++ b/src/classes/grid.js @@ -213,22 +213,20 @@ window.kg.Grid = function (options) { self.config.maintainColumnRatios === false ? $.noop() : self.config.maintainColumnRatios = true; // get the remaining width var remainingWidth = self.rootDim.outerWidth() - totalWidth; + var offset = 2; //We're going to remove 2 px so we won't overflow the viewport by default + // are we overflowing? + if (self.maxCanvasHt() > self.viewportDimHeight()) { + //compensate for scrollbar + offset += window.kg.domUtilityService.ScrollW; + } + remainingWidth -= offset; + if (remainingWidth < 0) remainingWidth = 0; // calculate the weight of each asterisk rounded down var asteriskVal = Math.floor(remainingWidth / asteriskNum); // set the width of each column based on the number of stars $.each(asterisksArray, function (i, col) { var t = col.width.length; columns[col.index].width = asteriskVal * t; - //check if we are on the last column - if (col.index + 1 == numOfCols) { - var offset = 2; //We're going to remove 2 px so we won't overlflow the viwport by default - // are we overflowing? - if (self.maxCanvasHt() > self.viewportDimHeight()) { - //compensate for scrollbar - offset += window.kg.domUtilityService.ScrollW; - } - columns[col.index].width -= offset; - } totalWidth += columns[col.index].width; }); }