Skip to content

Commit 3e8d8c6

Browse files
committed
adjustPadding for unbound items during scroll up fix
1 parent 0e87883 commit 3e8d8c6

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/ui-scroll.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,18 @@ angular.module('ui.scroll', [])
381381
bottomPadding.height(bottomPaddingHeight + bottomPaddingHeightAdd);
382382
},
383383

384+
adjustPaddingUnbound(updates) {
385+
if (updates.prepended && updates.prepended.length)
386+
topPadding.height(topPadding.height() + updates.estimatedPaddingIncrement);
387+
else
388+
viewport.adjustPadding();
389+
},
390+
391+
adjustPaddingBound(updates) {
392+
if (updates.prepended && updates.prepended.length)
393+
topPadding.height(topPadding.height() - updates.estimatedPaddingIncrement);
394+
},
395+
384396
adjustScrollTopAfterMinIndexSet(topPaddingHeightOld) {
385397
// additional scrollTop adjustment in case of datasource.minIndex external set
386398
if(buffer.minIndexUser && buffer.minIndex > buffer.minIndexUser) {
@@ -841,10 +853,13 @@ angular.module('ui.scroll', [])
841853
function adjustBufferAfterFetch(rid) {
842854
let updates = updateDOM();
843855

844-
viewport.adjustPadding();
856+
viewport.adjustPaddingUnbound(updates);
845857

846858
// We need the item bindings to be processed before we can do adjustment
847859
$timeout(() => {
860+
861+
viewport.adjustPaddingBound(updates);
862+
848863
if (isInvalid(rid)) {
849864
return;
850865
}

0 commit comments

Comments
 (0)