ProMotion icon indicating copy to clipboard operation
ProMotion copied to clipboard

Idea: add "on_stopped_scrolling" and "on_scroll" to PM::TableScreen

Open jamonholmgren opened this issue 9 years ago • 7 comments

  def scrollViewDidEndDecelerating(_)
    try :on_stopped_scrolling
  end

  def scrollViewDidEndDragging(_, willDecelerate: decelerate)
    try :on_stopped_scrolling unless decelerate
  end

  def scrollViewDidScroll(_)
    try :on_scroll
  end

What think ye?

jamonholmgren avatar Mar 04 '15 20:03 jamonholmgren

I like it! :+1:

markrickert avatar Mar 05 '15 02:03 markrickert

In addition to this, and referring this question... why not implement this way ?

def scrollViewDidScroll(scroll_view)
   current_y = scroll_view.contentOffset.y
   @previous_y ||= 0

   if self.respond_to?(:on_scroll)
      try :on_scroll
   elsif current_y > @previous_y 
      try :on_scroll_down
   else
      try :on_scroll_up
   end

  # keep track of current_y 
  @previous_y = current_y
end

bmichotte avatar Sep 17 '15 14:09 bmichotte

@bmichotte Yes! Also, we could give an optional parameter for velocity.

http://stackoverflow.com/a/9705218/204044

jamonholmgren avatar Sep 17 '15 14:09 jamonholmgren

Nice idea.

bmichotte avatar Sep 17 '15 15:09 bmichotte

:+1: So is there any ETA on this?

edenvicary avatar Dec 09 '15 00:12 edenvicary

Feel free to tackle it, @edenvicary ! I don't intend to anytime soon, so it's a great way to contribute.

jamonholmgren avatar Dec 09 '15 07:12 jamonholmgren

@afestein could be a good way to clean up some of that code.

edenvicary avatar Dec 09 '15 07:12 edenvicary