 
     isDecelerating: -> true
 
-    shouldStartMomentum: -> true
+    shouldStartMomentum: ->
+      return true
+      # @lastTouchY
+      contentOffsetY = @getContentOffsetY()
+      return false if contentOffsetY > 30
+      return true
 
     stopMomentum: () ->
       if @isDecelerating()


  class Scroller
    constructor: (@element) ->
      @startTouchY = 0
      @contentStartOffsetY = 0
      @element.addEventListener('touchstart', this, false)
      @element.addEventListener('touchmove', this, false)

        # Set the element transform to where it is right now.
        @animateTo(transform.m42)

    # Calculate the movement properties. Implement getEndVelocity using the
    # start and end position / time.
    calculateMomentum: () ->
      velocity = @getEndVelocity()
      acceleration = if velocity < 0 then 0.0005 else -0.0005
      displacement = - (velocity * velocity) / (2 * acceleration)
      time = - velocity / acceleration
      newY = @contentOffsetY + displacement
      return {
        velocity: velocity
        acceleration: acceleration
        displacement: displacement
        time: time
        newY: newY
      }

    startMomentum: () ->
      m = @calculateMomentum()

      # Set up the transition and execute the transform. Once you implement this
      # you will need to figure out an appropriate time to clear the transition
      # so that it doesn’t apply to subsequent scrolling.
      # @element.style.webkitTransition = '-webkit-transform ' + time + 'ms cubic-bezier(0.33, 0.66, 0.66, 1)'
      @element.style.webkitTransition = '-webkit-transform ' + m.time + 'ms cubic-bezier(0.33, 0.66, 0.66, 1)'
      @element.style.webkitTransform = 'translate3d(0,' + m.newY + 'px, 0)'
      @contentOffsetY = m.newY
      console.log "startMomentum", m

    snapToBounds: () ->
    
