Skip to content

Commit

Permalink
fixed bug where scrolling didnt reach last row
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony Germaneri committed Mar 22, 2018
1 parent f71b248 commit feeb264
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 14 deletions.
2 changes: 1 addition & 1 deletion build.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1965
1970
9 changes: 5 additions & 4 deletions dist/canvas-datagrid.debug.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/canvas-datagrid.debug.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/canvas-datagrid.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/canvas-datagrid.map

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions lib/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ define([], function () {
ch = self.style.cellHeight;
// sets actual DOM canvas element
function setScrollBoxSize() {
self.scrollBox.width = self.width - rowHeaderCellWidth - cellBorder;
self.scrollBox.height = self.height - columnHeaderCellHeight - columnHeaderCellBorder;
self.scrollBox.width = self.width - rowHeaderCellWidth;
self.scrollBox.height = self.height - columnHeaderCellHeight;
}
function setCanvasSize() {
if (self.isChildGrid) {
Expand Down Expand Up @@ -161,6 +161,7 @@ define([], function () {
self.scrollCache.x[columnIndex] = va;
return va;
}, 0) || 0;
dataHeight += columnHeaderCellHeight;
if (self.attributes.showNewRow) {
dataHeight += ch;
}
Expand Down Expand Up @@ -210,7 +211,7 @@ define([], function () {
// set again after bar visibility checks
setScrollBoxSize();
self.scrollBox.scrollWidth = dataWidth - self.scrollBox.width;
self.scrollBox.scrollHeight = dataHeight - self.scrollBox.height;
self.scrollBox.scrollHeight = dataHeight - self.scrollBox.height - columnHeaderCellHeight;
self.scrollBox.widthBoxRatio = self.scrollBox.width / dataWidth;
self.scrollBox.scrollBoxWidth = self.scrollBox.width
* self.scrollBox.widthBoxRatio
Expand All @@ -220,7 +221,7 @@ define([], function () {
// it being off causes the scroll bar to "slide" under
// the dragged mouse.
// https://github.com/TonyGermaneri/canvas-datagrid/issues/97
self.scrollBox.heightBoxRatio = self.scrollBox.height / dataHeight;
self.scrollBox.heightBoxRatio = self.scrollBox.height / (dataHeight - columnHeaderCellHeight);
self.scrollBox.scrollBoxHeight = self.scrollBox.height
* self.scrollBox.heightBoxRatio
- self.style.scrollBarWidth - b - d;
Expand Down
6 changes: 4 additions & 2 deletions tutorials/developer.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function g() {
grid.style.cellHeight = 40;
grid.style.height = '100%';
grid.style.width = '100%';
for (x = 0; x < 4; x += 1) {
for (x = 0; x < 7; x += 1) {
data[x] = {};
for (y = 0; y < 4; y += 1) {
data[x][String.fromCharCode(65 + y)] = '';
Expand All @@ -24,5 +24,7 @@ function g() {
data[x - 1][String.fromCharCode(65 + y - 1)] = 'EOF';
grid.data = data;
grid.style.height = '100%';
grid.style.width = 'auto';
grid.style.width = '100%';
// grid.style.height = 'auto';
// grid.style.width = 'auto';
}

0 comments on commit feeb264

Please sign in to comment.