@@ -221,20 +221,13 @@ angular.module('ui.scroll', [])
221
221
topPadding .height (buffer .first - buffer .minIndex ()) * viewport .averageItemHeight
222
222
bottomPadding .height (buffer .maxIndex () - buffer .next + 1 ) * viewport .averageItemHeight
223
223
224
- viewport .adjustScrollTop = (options ) ->
225
- return if not options or not options .height
226
- # edge case 1, scroll up from the very top position
227
- if options .prepend
228
- paddingHeight = topPadding .height () - options .height
229
- if paddingHeight >= 0
230
- topPadding .height paddingHeight
231
- else
232
- topPadding .height 0
233
- viewport .scrollTop viewport .scrollTop () - paddingHeight
234
-
235
- # edge case 2, scroll down from the very bottom position
236
- # if options.clipTop and options.height - bottomPadding.height() > 0
237
- # viewport.scrollTop viewport.scrollTop() + options.height - bottomPadding.height()
224
+ viewport .adjustScrollTop = (height ) ->
225
+ paddingHeight = topPadding .height () - height
226
+ if paddingHeight >= 0
227
+ topPadding .height paddingHeight
228
+ else
229
+ topPadding .height 0
230
+ viewport .scrollTop viewport .scrollTop () - paddingHeight
238
231
239
232
viewport
240
233
@@ -430,12 +423,12 @@ angular.module('ui.scroll', [])
430
423
promises = promises .concat (buffer .remove wrapper)
431
424
432
425
if toBePrepended .length
433
- adjustPaddingSettings = { height : 0 , prepend : true }
426
+ adjustedPaddingHeight = 0
434
427
for wrapper in toBePrepended
435
428
keepFetching = insertWrapperContent (wrapper) || keepFetching
436
429
wrapper .op = ' none'
437
- adjustPaddingSettings . height += wrapper .element .height ()
438
- viewport .adjustScrollTop (adjustPaddingSettings )
430
+ adjustedPaddingHeight += wrapper .element .height ()
431
+ viewport .adjustScrollTop (adjustedPaddingHeight )
439
432
440
433
# re-index the buffer
441
434
item .scope .$index = buffer .first + i for item,i in buffer
0 commit comments