Method: MotionPrime::AbstractCollectionSection#update_pull_to_refresh_after_scroll

Defined in:
motion-prime/sections/abstract_collection.rb

#update_pull_to_refresh_after_scroll(scroll) ⇒ Object



236
237
238
239
240
241
242
243
244
245
246
# File 'motion-prime/sections/abstract_collection.rb', line 236

def update_pull_to_refresh_after_scroll(scroll)
  return unless refresh_view = collection_view.try(:pullToRefreshView)
  return refresh_view.alpha = 1 if refresh_view.state == SVPullToRefreshStateLoading

  current_offset = scroll.contentOffset.y
  table_inset = collection_view.contentInset.top
  refresh_offset = refresh_view.yOrigin
  alpha = [[-(current_offset + table_inset)/refresh_view.size.height, 0].max, 1].min

  refresh_view.alpha = alpha
end