Skip to content

Commit 903b7a7

Browse files
committed
Fixing comments for horizontal scrolling to a column. No functional changes
1 parent c5ea13d commit 903b7a7

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

src/js/core/factories/Grid.js

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2363,18 +2363,13 @@ angular.module('ui.grid')
23632363

23642364
// We were given a column to scroll to
23652365
if (gridCol !== null) {
2366-
// This is the index of the row we want to scroll to, within the list of rows that can be visible
2366+
// This is the index of the column we want to scroll to, within the list of columns that can be visible
23672367
var seekColumnIndex = visColCache.indexOf(gridCol);
23682368

2369-
// Total vertical scroll length of the grid
2369+
// Total horizontal scroll length of the grid
23702370
var horizScrollLength = (self.renderContainers.body.getCanvasWidth() - self.renderContainers.body.getViewportWidth());
23712371

2372-
// Add the height of the native horizontal scrollbar to the scroll length, if it's there. Otherwise it will mask over the final row
2373-
// if (self.verticalScrollbarWidth && self.verticalScrollbarWidth > 0) {
2374-
// horizScrollLength = horizScrollLength + self.verticalScrollbarWidth;
2375-
// }
2376-
2377-
// This is the minimum amount of pixels we need to scroll vertical in order to see this column
2372+
// This is the minimum amount of pixels we need to scroll horizontal in order to see this column
23782373
var columnLeftEdge = 0;
23792374
for (var i = 0; i < seekColumnIndex; i++) {
23802375
var col = visColCache[i];
@@ -2389,9 +2384,9 @@ angular.module('ui.grid')
23892384

23902385
var horizScrollPixels, horizPercentage;
23912386

2392-
// If the scroll position we need to see the row is LESS than the top boundary, i.e. obscured above the top of the self...
2387+
// If the scroll position we need to see the column is LESS than the left boundary, i.e. obscured before the left of the self...
23932388
if (columnLeftEdge < leftBound) {
2394-
// Get the different between the top boundary and the required scroll position and subtract it from the current scroll position\
2389+
// Get the different between the left boundary and the required scroll position and subtract it from the current scroll position\
23952390
// to get the full position we need
23962391
horizScrollPixels = self.renderContainers.body.prevScrollLeft - (leftBound - columnLeftEdge);
23972392

@@ -2400,9 +2395,9 @@ angular.module('ui.grid')
24002395
horizPercentage = (horizPercentage > 1) ? 1 : horizPercentage;
24012396
scrollEvent.x = { percentage: horizPercentage };
24022397
}
2403-
// Otherwise if the scroll position we need to see the row is MORE than the bottom boundary, i.e. obscured below the bottom of the self...
2398+
// Otherwise if the scroll position we need to see the column is MORE than the right boundary, i.e. obscured after the right of the self...
24042399
else if (columnRightEdge > rightBound) {
2405-
// Get the different between the bottom boundary and the required scroll position and add it to the current scroll position
2400+
// Get the different between the right boundary and the required scroll position and add it to the current scroll position
24062401
// to get the full position we need
24072402
horizScrollPixels = columnRightEdge - rightBound + self.renderContainers.body.prevScrollLeft;
24082403

0 commit comments

Comments
 (0)