           move:       @gestureMove.bind @
           end:        @gestureEnd.bind @
 
-  # _setVerticalAxis: ->
-  #   @newPoint = (mainV, crossV = 0) -> point crossV, mainV
-  #   @getPagePosition = (page) -> page?.transformToAncestorSpaceY(0, @) || 0
-  #   @getMainCoordinate = (pnt) -> pnt.y
-
-  # _setHorizontalAxis: ->
-  #   @newPoint = (mainV, crossV = 0) -> point mainV, crossV
-  #   @getPagePosition = (page) -> page?.transformToAncestorSpaceX(0, @) || 0
-  #   @getMainCoordinate = (pnt) -> pnt.x
-
-  # getPageSize: (page) -> if !page then 0 else @getMainCoordinate page.getCurrentSize()
-  # getPageEdgeOffset: ({page, atEndEdge}) -> if atEndEdge then @getPageSize page else 0
-  # getPageCenter: (page)-> @getPagePosition(page) + @getPageSize(page) / 2
-
-  # defaultReferenceFrame =
-  #   page: null
-  #   atEndEdge: false
-
-  # @concreteProperty
-  #   startAtEnd: default: false
-
-  #   referenceFrame:
-  #     default: defaultReferenceFrame
-
-  #     postSetter: (newReferenceFrame, previousReferenceFrame) ->
-  #       console.warn "referenceFrame_postSetter - frame didn't change" unless newReferenceFrame != previousReferenceFrame
-
-  #       @_addToScrollPosition delta = @getReferenceFrameDelta newReferenceFrame, previousReferenceFrame
-  #       # log setReferenceFrame:
-  #       #   newReferenceFrame: newReferenceFrame
-  #       #   previousReferenceFrame: previousReferenceFrame
-  #       #   delta: delta
-
-  #       @_updatePointerReferenceFrame newReferenceFrame
-
-  #       @_queueUpdateEvent newReferenceFrame, previousReferenceFrame
-
-  #       @_updatePagesSplit()
-
-  #   pages:
-  #     default: []
-  #     validate: (pages) -> isPlainArray pages
-  #     postSetter: (pages, oldPages)->
-
-  #       {page, atEndEdge} = referenceFrame = @getPendingReferenceFrame()
-
-  #       if @_atEnd
-  #         atEndEdge = true
-  #         page = last pages
-  #       if @_atStart || !page
-  #         atEndEdge = false
-  #         page = first pages
-
-  #       # log setPages:
-  #       #   atStart: @_atStart
-  #       #   atEnd: @_atEnd
-  #       #   pages: pages && (p?.inspectedName for p in pages)
-  #       #   referenceFrame:
-  #       #     page: page?.inspectedName
-  #       #     atEndEdge: atEndEdge
-
-  #       if referenceFrame.page && 0 > pages.indexOf referenceFrame.page
-  #         console.warn(
-  #           """
-  #           PagingScrollElement#pages setter: New page list does not contain the current referenceFrame. ALWAYS include the current referenceFrame when setting pages. Screen will jump!
-
-  #           page keys: #{inspect (page.key for page in pages)}
-  #           """
-  #         )
-
-  #       if referenceFrame.page != page || referenceFrame.atEndEdge != atEndEdge
-  #         # setReferenceFrame will call _updatePagesSplit
-  #         @setReferenceFrame page: page, atEndEdge: atEndEdge
-  #       else
-  #         @_updatePagesSplit()
-
-  #       if oldPages.length > 0
-  #         @onNextReady => @_updateAtStartAndAtEnd()
-
-  #   scrollPosition:
-  #     default: 0
-  #     postSetter: (position) ->
-  #       @_scrollPositionChanged()
-  #       # throw new Error if maxCount-- < 0
-  #       # console.error "setScrollPosition #{position}"
-  #       @onNextReady => @_updateAtStartAndAtEnd()
-  #       ###
-  #       TODO
-  #       NOTES on childrenAlignment:
-  #         This doesn't work yet.
-
-  #         This needs to update whenever the size of children or parent changes.
-
-  #         This code only updates when scrollPosition changes.
-  #       ###
-  #       # if @_scrollContents.getCurrentSize().lte @getCurrentSize()
-  #       #   axis = @_scrollContents.setAxis @getPendingChildrenAlignment()
-  #       #   @_scrollContents.setLocation ww: axis.x, hh: axis.y
-  #       #   @newPoint position
-  #       # else
-  #       #   @_scrollContents.setAxis 0
-  #       @_scrollContents.setLocation @newPoint position
-  # # maxCount = 5
-
   _scrollPositionChanged: ->
     unless @_activelyScrolling
       @queueEvent "scrollingActive"

        @_activelyScrolling = false
        @queueEvent "scrollingIdle"

  # _updatePagesSplit: (pages = @getPendingPages(), referenceFrame = @getPendingReferenceFrame())->

  #   {page, atEndEdge} = referenceFrame

  #   splitIndex = pages.indexOf page
  #   if splitIndex < 0

  #     if page
  #       console.warn "PagingScrollElement#_updatePagesSplit: could not find the old
  #         referenceFrame.page(key: #{page.key || page.inspectedName}) in the new children. New current page picked;
  #         display WILL jump."

  #     splitIndex = 0

  #   splitIndex++ if atEndEdge

  #   @_pagesBeforeBaselineWrapper.setChildren pages.slice 0, splitIndex
  #   @_pagesAfterBaselineWrapper.setChildren  pages.slice splitIndex

  # @layoutProperty
  #   scroll:
  #     default: "vertical"
  #     validate: (v) -> v == "vertical" || v == "horizontal"
  #     postSetter: (newV, oldValue) ->
  #       if newV == "vertical"
  #         @_setVerticalAxis()
  #       else
  #         @_setHorizontalAxis()
  #       @_updateHiddenChildren newV

  # ######################################
  # # ScrollAnimator expects this API
  # ######################################

  # getReferenceFrameDelta: (toReferenceFrame = defaultReferenceFrame, fromReferenceFrame = defaultReferenceFrame) ->
  #   return 0 if toReferenceFrame == fromReferenceFrame

  #   positionDelta = if toReferenceFrame.page == fromReferenceFrame.page then 0
  #   else @getPagePosition(toReferenceFrame.page) - @getPagePosition(fromReferenceFrame.page)

  #   edgeDelta = @getPageEdgeOffset(toReferenceFrame) - @getPageEdgeOffset fromReferenceFrame

  #   positionDelta + edgeDelta

  # getScrollPositionInReferenceFrame: (targetReferenceFrame) ->
  #   @getScrollPosition() + @getReferenceFrameDelta targetReferenceFrame, @getReferenceFrame()

  # setScrollPositionInReferenceFrame: (scrollPosition, referenceFrame = @getPendingReferenceFrame()) ->
  #   @onNextReady => @_updateReferenceFrame()

  #   pendingReferenceFrame = @getPendingReferenceFrame()

  #   scrollPosition        += @getReferenceFrameDelta pendingReferenceFrame, referenceFrame

  #   # TODO: I'd like to do this "boundedScrollPosition", but it messes up ScrollAnimator
  #   #   I think that means we'd have to have an "actual" scroll position and the scrollPosition
  #   #   ScrollAnimator sees. Further, if they are out of sync, we need another animator bringing
  #   #   them into sync as quickly as possible.
  #   # currentScrollPosition = @getScrollPosition()
  #   # currentReferenceFrame = @getReferenceFrame()
  #   # currentScrollPosition += @getReferenceFrameDelta pendingReferenceFrame, currentReferenceFrame

  #   # boundedScrollPosition = maxChange scrollPosition, currentScrollPosition, @getWindowSize() / 2
  #   # if boundedScrollPosition != scrollPosition
  #   #   log
  #   #     boundedScrollPosition: boundedScrollPosition
  #   #     scrollPosition: scrollPosition
  #   #     currentScrollPosition: currentScrollPosition
  #   #     windowSize: @getWindowSize()

  #   # never move more than one screen-full in one frame
  #   @setScrollPosition scrollPosition

  # @getter
  #   minScrollPosition: -> @getMinScrollPositionInReferenceFrame @getReferenceFrame()
  #   maxScrollPosition: -> @getMaxScrollPositionInReferenceFrame @getReferenceFrame()

  # getMinScrollPositionInReferenceFrame: (referenceFrame)->
  #   windowSize = @getWindowSize()
  #   beforeSize = @getPagesBeforeBaselineSize()
  #   afterSize = @getPagesAfterBaselineSize()
  #   return 0 if beforeSize + afterSize <= windowSize
  #   windowSize - afterSize + @getReferenceFrameDelta referenceFrame, @getReferenceFrame()

  # getMaxScrollPositionInReferenceFrame: (referenceFrame)->
  #   windowSize = @getWindowSize()
  #   beforeSize = @getPagesBeforeBaselineSize()
  #   afterSize = @getPagesAfterBaselineSize()
  #   delta = @getReferenceFrameDelta referenceFrame, @getReferenceFrame()
  #   # log getMaxScrollPositionInReferenceFrame:
  #   #   referenceFrame: referenceFrame
  #   #   windowSize:windowSize
  #   #   beforeSize:beforeSize
  #   #   afterSize:afterSize
  #   #   delta:delta
  #   return 0 if beforeSize + afterSize <= windowSize
  #   beforeSize + delta

  # jumpToStart: ->
  #   @setScrollPositionInReferenceFrame 0,
  #     page: first @getPendingPages()
  #     atEndEdge: false

  # jumpToEnd: ->
  #   log "jumpToEnd"
  #   if @getPagesFitInWindow()
  #     @jumpToStart()
  #   else
  #     @setScrollPositionInReferenceFrame @getWindowSize(),
  #       page: last @getPendingPages()
  #       atEndEdge: true

  # ######################################
  @getter
    isVertical:                -> @_childrenLayout == "column"


    oldCurrentPage: element
    currentPage:    element
  scrollUpdate:
    childrenOffset:           number (pixels)
    childrenSize:             number (pixels)
    windowSize:               number (pixels)
    focusedChild:             element
    firstOnScreenChildIndex:  number
    lastOnScreenChildIndex:   number
    focusedChildIndex:        number

naming:

