Skip to content

Commit

Permalink
a fix for #8
Browse files Browse the repository at this point in the history
  • Loading branch information
mfeingold committed Jul 28, 2015
1 parent fe10649 commit c735a2a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Gruntfile.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = (grunt) ->
connect:
app:
options:
base: './src/'
base: './'
middleware: require './server/middleware'
port: 5001
watch:
Expand Down
2 changes: 1 addition & 1 deletion server/middleware.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = (connect, options) ->
app.use express.bodyParser()
app.use express.methodOverride()
app.use express.errorHandler()
app.use express.static options.base
app.use express.static options.base[0]
app.use app.router
routes app, options
[connect(app)]
16 changes: 10 additions & 6 deletions src/ui-scroll.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -308,18 +308,22 @@ angular.module('ui.scroll', [])

# We need the item bindings to be processed before we can do adjustment
$timeout ->

for wrapper in toBePrepended
builder.insertElement wrapper.element
# an element is inserted at the top
newHeight = builder.topPadding() - wrapper.element.outerHeight(true)
prepFirst = prepFirst || wrapper.element # element prepended first
prepLast = wrapper.element # element prepended last
wrapper.op = 'none'

if prepFirst
heightIncrement = prepFirst.next().offset().top - prepLast.offset().top
# adjust padding to prevent it from visually pushing everything down
if newHeight >= 0
if builder.topPadding() >= heightIncrement
# if possible, reduce topPadding
builder.topPadding(newHeight)
builder.topPadding(builder.topPadding() - heightIncrement)
else
# if not, increment scrollTop
viewport.scrollTop(viewport.scrollTop() + wrapper.element.outerHeight(true))
wrapper.op = 'none'
viewport.scrollTop(viewport.scrollTop() + heightIncrement)

for wrapper in toBeRemoved
promises = promises.concat (removeItem wrapper)
Expand Down

0 comments on commit c735a2a

Please sign in to comment.