   axisName = scrollProperties[direction].axisName
   before = element[axisName]
   element[axisName] += amount
-  amount == element[axisName] - before
+  element[axisName] == amount + before
 
 # Test whether element should be scrolled.
 shouldScroll = (element, direction) ->

    previousTimestamp = null
    animatorId = null

    advanceAnimation = ->
      animatorId = requestAnimationFrame animate

    cancelAnimation = ->
      cancelAnimationFrame animatorId

    animate = (timestamp) ->
      previousTimestamp ?= timestamp

      if timestamp == previousTimestamp
        return advanceAnimation()

      # The elapsed time is typically about 16ms.
      elapsed = timestamp - previousTimestamp

    return if @lastEvent?.repeat

    activationTime = ++@time
    isMyKeyStillDown = => @time == activationTime and @keyIsDown

    # Store amount's sign and make amount positive; the logic is clearer when amount is positive.
    sign = Math.sign amount
