Skip to content

Commit ef63d06

Browse files
committed
Trigger scroll end when no scrollbar is visible
1 parent fa26ca3 commit ef63d06

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

dist/tileview.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,10 @@
101101
});
102102
layout();
103103
});
104-
scope.$watch('items', layout);
104+
scope.$watch('items', function () {
105+
lastScrollPosition = Number.NEGATIVE_INFINITY;
106+
layout();
107+
});
105108
scope.$on('td.tileview.resize', layout);
106109
angular.element($window).on('resize', onResize);
107110
scope.$on('$destroy', function () {
@@ -127,7 +130,7 @@
127130
function itemElementCount() {
128131
return itemContainer.children().length;
129132
}
130-
var lastScrollPosition = 0;
133+
var lastScrollPosition = Number.NEGATIVE_INFINITY;
131134
function updateVisibleRows() {
132135
function clamp(value, min, max) {
133136
return Math.max(Math.min(value, max), min);

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-tileview",
3-
"version": "0.3.2",
3+
"version": "0.3.3",
44
"description": "A tileview for angular",
55
"main": "gulpfile.js",
66
"scripts": {

src/tileview.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@ declare const angular: any;
110110
});
111111
layout();
112112
});
113-
scope.$watch('items', layout);
113+
scope.$watch('items', () => {
114+
lastScrollPosition = Number.NEGATIVE_INFINITY;
115+
layout();
116+
});
114117
scope.$on('td.tileview.resize', layout);
115118

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

146-
let lastScrollPosition = 0;
149+
let lastScrollPosition = Number.NEGATIVE_INFINITY;
147150
function updateVisibleRows() {
148151
function clamp(value, min, max) {
149152
return Math.max(Math.min(value, max), min);

0 commit comments

Comments
 (0)