Skip to content

Commit

Permalink
Fix scroll on top : add a check if the scroll count and vertical scro…
Browse files Browse the repository at this point in the history
…ll length are negative (Mean no scroll)

Update of fix scroll on top/bottom : add a check if vertical scroll length is negative, mean 'Let the parent container scroll
  • Loading branch information
Jacquelin committed Jun 4, 2015
1 parent 58bd0eb commit bad61ca
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/js/core/directives/ui-grid-render-container.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
var scrollYAmount = event.deltaY * -1 * event.deltaFactor;

scrollTop = containerCtrl.viewport[0].scrollTop;

// Get the scroll percentage
var scrollYPercentage = (scrollTop + scrollYAmount) / rowContainer.getVerticalScrollLength();

Expand All @@ -98,7 +99,8 @@
}

// Let the parent container scroll if the grid is already at the top/bottom
if ((event.deltaY !== 0 && (scrollEvent.atTop(scrollTop) || scrollEvent.atBottom(scrollTop))) ||
if (rowContainer.getVerticalScrollLength() < 0 ||
(event.deltaY !== 0 && (scrollEvent.atTop(scrollTop) || scrollEvent.atBottom(scrollTop))) ||
(event.deltaX !== 0 && (scrollEvent.atLeft(scrollLeft) || scrollEvent.atRight(scrollLeft)))) {
//parent controller scrolls
}
Expand Down

0 comments on commit bad61ca

Please sign in to comment.