       @fire('drag')
 
     _onUp: (e) ->
-      if @animate && @_positions.length > 0
+      if @animate && @_positions?.length > 0
         dx = @_newPos.x - @_positions[0]
         dt = +new Date() - @_times[0]
         v = dx/dt

          @_pan(deltaX)

      # Safari
      L.DomEvent.on svg, 'mousewheel', (e) =>
        return unless allowWheel

        deltaX = e.wheelDeltaX
        deltaY = e.wheelDeltaY
        doScroll(deltaX, deltaY, e)

        e.preventDefault()

      # Chrome/Firefox
      L.DomEvent.on svg, 'wheel', (e) =>
        return unless allowWheel
        return if e.type == "mousewheel"

        # 'wheel' deltas are opposite from 'mousewheel'
        deltaX = -e.deltaX
        deltaY = -e.deltaY
        doScroll(deltaX, deltaY, e)

        e.preventDefault()

    _setupDragBehavior: (svg) ->
      self = this

        x = e.clientX - svg.clientLeft - origin
        time = @positionToTime(x)

      doScroll = (deltaX, deltaY, time) =>
        return unless allowWheel
        if Math.abs(deltaY) > Math.abs(deltaX)
          levels = if deltaY > 0 then -1 else 1
          @_deltaZoom(levels, time)
