Skip to content

Commit

Permalink
Tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Vaughn committed Jun 18, 2019
1 parent c035eee commit 7a8a1bf
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/FixedSizeGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ const FixedSizeGrid = createGridComponent({
if (scrollLeft >= minOffset && scrollLeft <= maxOffset) {
return scrollLeft;
} else if (minOffset > maxOffset) {
// Because we only take into account the scrollbar size when calculating minOffset
// this value can be larger than maxOffset when at the end of the list
return minOffset;
} else if (scrollLeft - minOffset < maxOffset - scrollLeft) {
return minOffset;
Expand Down Expand Up @@ -117,9 +119,9 @@ const FixedSizeGrid = createGridComponent({
default:
if (scrollTop >= minOffset && scrollTop <= maxOffset) {
return scrollTop;
} else if (minOffset > maxOffset) {
// Because we only take into account the scrollbar size when calculating minOffset
// this value can be larger than maxOffset when at the end of the list
} else if (minOffset > maxOffset) {
return minOffset;
} else if (scrollTop - minOffset < maxOffset - scrollTop) {
return minOffset;
Expand Down
2 changes: 1 addition & 1 deletion src/VariableSizeGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,9 @@ const getOffsetForIndexAndAlignment = (
default:
if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
return scrollOffset;
} else if (minOffset > maxOffset) {
// Because we only take into account the scrollbar size when calculating minOffset
// this value can be larger than maxOffset when at the end of the list
} else if (minOffset > maxOffset) {
return minOffset;
} else if (scrollOffset - minOffset < maxOffset - scrollOffset) {
return minOffset;
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/FixedSizeGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ describe('FixedSizeGrid', () => {
);
});

it('should scroll to the correct item for align = "auto" at the end of the grid', () => {
it('should scroll to the correct item for align = "auto" at the right hand side of the grid', () => {
getScrollbarSize.mockImplementation(() => 20);

const rendered = ReactTestRenderer.create(
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/VariableSizeGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ describe('VariableSizeGrid', () => {
);
});

it('should scroll to the correct item for align = "auto" at the end of the grid', () => {
it('should scroll to the correct item for align = "auto" at the right hand side of the grid', () => {
getScrollbarSize.mockImplementation(() => 20);

const rendered = ReactTestRenderer.create(
Expand Down

0 comments on commit 7a8a1bf

Please sign in to comment.