Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compensate for scrollbar width across all asterisked columns instead of just the last one #263

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions src/classes/grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
}
Expand Down