Skip to content

Commit 373f787

Browse files
committed
bottomPadding calculation adjustment
1 parent 310ef56 commit 373f787

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

Diff for: src/ui-scroll.coffee

+5-6
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,6 @@ angular.module('ui.scroll', [])
150150
viewport: viewport
151151
topPadding: -> topPadding.paddingHeight.apply(topPadding, arguments)
152152
bottomPadding: -> bottomPadding.paddingHeight.apply(bottomPadding, arguments)
153-
topOffset: -> topPadding.offset().top + topPadding.outerHeight()
154-
bottomOffset: -> bottomPadding.offset().top
155153
bottomDataPos: ->
156154
scrollHeight(viewport) - bottomPadding.paddingHeight()
157155
topDataPos: ->
@@ -292,7 +290,7 @@ angular.module('ui.scroll', [])
292290
# We need the item bindings to be processed before we can do adjustment
293291
$timeout ->
294292

295-
topOffset = builder.topOffset()
293+
bottomPos = builder.bottomDataPos()
296294
for wrapper, i in buffer
297295
switch wrapper.op
298296
when 'prepend' then toBePrepended.unshift wrapper
@@ -313,14 +311,15 @@ angular.module('ui.scroll', [])
313311
for wrapper in toBeRemoved
314312
promises = promises.concat (removeItem wrapper)
315313

316-
builder.bottomPadding(Math.max(0,builder.bottomPadding() - (builder.topOffset() - topOffset)))
314+
# for anything other than prepend adjust the bottomPadding height
315+
builder.bottomPadding(Math.max(0,builder.bottomPadding() - (builder.bottomDataPos() - bottomPos)))
317316

318317
if toBePrepended.length
319-
bottomPos = builder.bottomOffset()
318+
bottomPos = builder.bottomDataPos()
320319
for wrapper in toBePrepended
321320
builder.insertElement wrapper.element
322321
wrapper.op = 'none'
323-
heightIncrement = builder.bottomOffset() - bottomPos
322+
heightIncrement = builder.bottomDataPos() - bottomPos
324323
# adjust padding to prevent it from visually pushing everything down
325324
if builder.topPadding() >= heightIncrement
326325
# if possible, reduce topPadding

0 commit comments

Comments
 (0)