Skip to content

Commit

Permalink
fix(columnWidth): Compensate for scrollbar only if there is vertical …
Browse files Browse the repository at this point in the history
…scroll
  • Loading branch information
netchampfaris committed Aug 23, 2018
1 parent 7531e13 commit a04a5a1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,3 +200,7 @@ $.scrollbarWidth = function scrollbarWidth() {

return scrollbarWidth;
};

$.hasVerticalOverflow = function (element) {
return element.scrollHeight > element.offsetHeight + 10;
};
2 changes: 2 additions & 0 deletions src/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ export default class Style {
}

compensateScrollbarWidth() {
if (!$.hasVerticalOverflow(this.bodyScrollable)) return;

requestAnimationFrame(() => {
const scrollbarWidth = $.scrollbarWidth();
const lastCol = this.datamanager.getColumn(-1);
Expand Down

0 comments on commit a04a5a1

Please sign in to comment.