Skip to content

Commit

Permalink
Trigger scroll end when no scrollbar is visible
Browse files Browse the repository at this point in the history
  • Loading branch information
widmoser committed Apr 25, 2016
1 parent fa26ca3 commit ef63d06
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
7 changes: 5 additions & 2 deletions dist/tileview.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@
});
layout();
});
scope.$watch('items', layout);
scope.$watch('items', function () {
lastScrollPosition = Number.NEGATIVE_INFINITY;
layout();
});
scope.$on('td.tileview.resize', layout);
angular.element($window).on('resize', onResize);
scope.$on('$destroy', function () {
Expand All @@ -127,7 +130,7 @@
function itemElementCount() {
return itemContainer.children().length;
}
var lastScrollPosition = 0;
var lastScrollPosition = Number.NEGATIVE_INFINITY;
function updateVisibleRows() {
function clamp(value, min, max) {
return Math.max(Math.min(value, max), min);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-tileview",
"version": "0.3.2",
"version": "0.3.3",
"description": "A tileview for angular",
"main": "gulpfile.js",
"scripts": {
Expand Down
7 changes: 5 additions & 2 deletions src/tileview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ declare const angular: any;
});
layout();
});
scope.$watch('items', layout);
scope.$watch('items', () => {
lastScrollPosition = Number.NEGATIVE_INFINITY;
layout();
});
scope.$on('td.tileview.resize', layout);

angular.element($window).on('resize', onResize);
Expand Down Expand Up @@ -143,7 +146,7 @@ declare const angular: any;
return itemContainer.children().length;
}

let lastScrollPosition = 0;
let lastScrollPosition = Number.NEGATIVE_INFINITY;
function updateVisibleRows() {
function clamp(value, min, max) {
return Math.max(Math.min(value, max), min);
Expand Down

0 comments on commit ef63d06

Please sign in to comment.