Flick in scrollview

I don’t see how to determine the final position of a scrollview after a flick. At the “ended” phase of the touch event my listener calls getContentPosition() to see how far up or down the content has scrolled. But the value of y is apparently captured at the moment when the scrollview is released, not when it finally coasts to a stop. Is some other event dispatched at the completion of a flick?

The reason I want to know the final position is that when the orientation changes I have to redraw and repopulate the scrollview. I would like use scrollToPosition to put the new scrollview at the same place as before instead of starting over at the top. The content is text, so I’ll have to make some some adjustments for the change in width, but I think that’s doable. First, however, I have to know the last position of the old scrollview, and I can’t see a way to do that. Any ideas?

there would be workaround for this maybe good idea would be to use

    object._view._velocity = 0

to stop scrolling after touch ended, so you would get exact pos of your scroll view.

Thats just my idea as newbie

Thanks for responding. You’re right, I can set friction=0 in the constructor, but I’d rather not deprive the user of that function.

I’m really surprised that there is no event that covers this. A flick doesn’t end with the touch event, but apparently what happens after that is inaccessible.

The coasting time after the scrollview is released appears to be constant, so I toyed with the idea of using performWithDelay() to call getContentPosition() after 5 seconds. But that seems like a fragile solution. The user could easily change the orientation in that time, which would invalidate the result.

sajent: What you’re looking for is the extinct “endedScroll” event, which vanished in newer versions of the Widget library without notice or explanation. I posted in January 2014 asking that “endedScroll” be restored: http://forums.coronalabs.com/topic/43778-restoring-deleted-scrollview-feature-endedscroll-event/

We’re approaching a year since that thread and it still hasn’t happened, as far as I know.

there would be workaround for this maybe good idea would be to use

    object._view._velocity = 0

to stop scrolling after touch ended, so you would get exact pos of your scroll view.

Thats just my idea as newbie

Thanks for responding. You’re right, I can set friction=0 in the constructor, but I’d rather not deprive the user of that function.

I’m really surprised that there is no event that covers this. A flick doesn’t end with the touch event, but apparently what happens after that is inaccessible.

The coasting time after the scrollview is released appears to be constant, so I toyed with the idea of using performWithDelay() to call getContentPosition() after 5 seconds. But that seems like a fragile solution. The user could easily change the orientation in that time, which would invalidate the result.

sajent: What you’re looking for is the extinct “endedScroll” event, which vanished in newer versions of the Widget library without notice or explanation. I posted in January 2014 asking that “endedScroll” be restored: http://forums.coronalabs.com/topic/43778-restoring-deleted-scrollview-feature-endedscroll-event/

We’re approaching a year since that thread and it still hasn’t happened, as far as I know.

hmmmm…this would be awesome to have, especially when you are trying to do things like manage memory of large scrollviews and are loading and unloading objects on the fly. Without endedScroll it makes dynamic scrollviews and friction useless as they dont work together.

Well, if it’s been gone for something like two years, I guess it’s fair to say it’s never coming back?

hmmmm…this would be awesome to have, especially when you are trying to do things like manage memory of large scrollviews and are loading and unloading objects on the fly. Without endedScroll it makes dynamic scrollviews and friction useless as they dont work together.

Well, if it’s been gone for something like two years, I guess it’s fair to say it’s never coming back?