In G2, scrollView is not that smooth?

i am having a problem with the scrollview, where a bug in the ‘setScrollHeight’ feature.

After creating a scroll view and setting the height (using ‘setScrollHeight’), the scroll-down effect is messed up.

Bug case : #31096

Sample code (based on Corona’s samples) :

-- -- Abstract: Scroll View sample app -- -- Version: 2.0 -- -- Sample code is MIT licensed, see http://www.coronalabs.com/links/code/license -- Copyright (C) 2010 Corona Labs Inc. All Rights Reserved. -- -- Demonstrates how to make text and graphics move up and down on touch, -- or scroll, using the widget libraries scrollView methods. -- -- Supports Graphics 2.0 ------------------------------------------------------------ display.setStatusBar( display.HiddenStatusBar ) local widget = require( "widget" ) -- Our ScrollView listener local function scrollListener( event ) local phase = event.phase local direction = event.direction if "began" == phase then --print( "Began" ) elseif "moved" == phase then --print( "Moved" ) elseif "ended" == phase then --print( "Ended" ) end -- If the scrollView has reached it's scroll limit if event.limitReached then if "up" == direction then print( "Reached Top Limit" ) elseif "down" == direction then print( "Reached Bottom Limit" ) elseif "left" == direction then print( "Reached Left Limit" ) elseif "right" == direction then print( "Reached Right Limit" ) end end return true end -- Create a ScrollView local scrollView = widget.newScrollView { left = 0, top = 0, width = display.contentWidth, height = display.contentHeight, bottomPadding = 50, id = "onBottom", horizontalScrollDisabled = true, verticalScrollDisabled = false, listener = scrollListener, } --Create a text object for the scrollViews title local titleText = display.newText("Move Up to Scroll", display.contentCenterX, 48, native.systemFontBold, 16) titleText:setFillColor( 0 ) -- insert the text object into the created display group scrollView:insert( titleText ) --Create a large text string local lotsOfText = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur imperdiet consectetur euismod. Phasellus non ipsum vel eros vestibulum consequat. Integer convallis quam id urna tristique eu viverra risus eleifend.\n\nAenean suscipit placerat venenatis. Pellentesque faucibus venenatis eleifend. Nam lorem felis, rhoncus vel rutrum quis, tincidunt in sapien. Proin eu elit tortor. Nam ut mauris pellentesque justo vulputate convallis eu vitae metus. Praesent mauris eros, hendrerit ac convallis vel, cursus quis sem. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque fermentum, dui in vehicula dapibus, lorem nisi placerat turpis, quis gravida elit lectus eget nibh. Mauris molestie auctor facilisis.\n\nCurabitur lorem mi, molestie eget tincidunt quis, blandit a libero. Cras a lorem sed purus gravida rhoncus. Cras vel risus dolor, at accumsan nisi. Morbi sit amet sem purus, ut tempor mauris.\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur imperdiet consectetur euismod. Phasellus non ipsum vel eros vestibulum consequat. Integer convallis quam id urna tristique eu viverra risus eleifend.\n\nAenean suscipit placerat venenatis. Pellentesque faucibus venenatis eleifend. Nam lorem felis, rhoncus vel rutrum quis, tincidunt in sapien. Proin eu elit tortor. Nam ut mauris pellentesque justo vulputate convallis eu vitae metus. Praesent mauris eros, hendrerit ac convallis vel, cursus quis sem. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque fermentum, dui in vehicula dapibus, lorem nisi placerat turpis, quis gravida elit lectus eget nibh. Mauris molestie auctor facilisis.\n\nCurabitur lorem mi, molestie eget tincidunt quis, blandit a libero. Cras a lorem sed purus gravida rhoncus. Cras vel risus dolor, at accumsan nisi. Morbi sit amet sem purus, ut tempor mauris. " --Create a text object containing the large text string and insert it into the scrollView local lotsOfTextObject = display.newText( lotsOfText, display.contentCenterX, 0, 300, 0, "Helvetica", 14) lotsOfTextObject:setFillColor( 0 ) lotsOfTextObject.anchorY = 0.0 -- Top --------------------------------lotsOfTextObject:setReferencePoint( display.TopCenterReferencePoint ) lotsOfTextObject.y = titleText.y + titleText.contentHeight + 10 scrollView:insert( lotsOfTextObject ) -- Adjust scroll height scrollView:setScrollHeight( 250 )

That is because you’ve set scroll height that is less than the height of the scroll view widget itself. You should not have to do that. At least i don’t see a use for it, I may be wrong.

Though there should be a check for that in the scroll view itself so this doesn’t happen.

@yosu

primoz.cerar is right. If you don’t set the height less than scrollView’s, there shouldn’t be a problem. I happened running into this issue couple days ago. So I had to check the scrollHeight before I set (in my case, my content height is dynamic). Of course, if you think scrollview should do the checking, probably it’s doable. But you have to either ask widget master primoz.cerar or Corona, I am not really sure.

By the way, please create another thread for your issue if you still feel like to discuss because the original problem in this post has not been fixed by Corona yet, so please don’t divert them to something else. We finally brought up their attention to this issue after 3 pages of discussion. 

Recently my app received a 3-stars review (which is unusual because my app is average 5 stars with 1000 reviews in total) and the user said in his comment,

Since recent updates, the scrolling does not run as smooth as before

From this comment, I think “since recent updates” means the time I migrated my app to G2, and the “scrolling” means the scrollView.

Even the end user can feel the scrollView has something wrong

I really hope Corona can try to feel it. It’s quite obvious if the app depends on scrollView a lot.

I second this. My scrollView’s are not remotely close to being as smooth as they were with G1.0, and worst of all this is the main complaint I receive from users right now…

G2 caused at least a 6 months step-back for all widgets. We are still not where we were bug-fix wise pre G2… All in the name of progress… 

@joe528

Make sure you have horizontalScrollDisabled=true when you create the scroll view. There is an issue like that I have seen when horizontal scrolling is enabled. It is meant to snap back to original y position if the y change was small and the x change passes the threshhold to start scrolling horizontaly. It is a bug in my opinion as vertical scrolling is supposed to respect the treshhold as well but it doesn’t, it starts scrolling immediately even if you move just by one pixel.

I have a really graphics heavy widget based on scrollView and in G1 I had to rewrite the scrolling functions because when there were a lot of items on the scroll view the scrolling started to act up really badly. I’m just in the process of migrating it to G2 and thought the new scrolling is better than it was in G1. It all looks fine in simulator but I haven’t done proper testing on device so I might have to resort back to my own scrolling functions if it has issues reported here.

@primoz.cerar

Thanks for the info. But I just checked my code and tested again, I already have horizontalScrollDisabled = true, and the problem is still there, even with Simulator.

G1 didn’t have such a problem I have been describing here.

This happens to me too. When scrolling vertically, it jumps around quite often (easily noticeable). Never had this issue with G1.0. Glad to see I’m not alone.

Anyone from Corona willing to give a possible solution to this? It really sucks having jerky scrolling everywhere, especially when it’s a main part of your app.

Same problem with our app. It does not look polish.

Daily 2178 seems to implement some improvement to transitions … This might have an improvement effect on the scrollView too. Lets see…

Just test with the latest build 2178, 

scrollView choppiness problem still exists.

I agree with all of you. This issue is a big deal especially when it comes to building business apps… I am sure the corona dev’s notice/know about the jerkiness/performance issue of scrollView/tableView - hopefully they can start focusing on that more because this eventually could be a showstopper for a lot of people trying to build business apps with corona.

Any solutions to this issue or comments from corona staff?

Is this an issue where you scroll over the top edge and before it snaps back try to scroll down again?

If it’s something else please try post a short sample that shows this and explain what you do to make it jump and I might be able to help you get a quick fix.

Currently, this is just more of a nuisance. We have optimized all of the images that come from our DB to the exact size they appear in the feed and that has helped considerably. However, even with all the images optimized and sized properly, if you scroll the content as it slows down it jerks or appears choppy and at certain speeds it jerks. Just doesn’t look smooth, consistently.

@Joe528 comments above describe a similar issue we are experiencing almost perfectly. 

I suppose my question is…

  • is it possible to achieve native-like scrolling with Corona? That is smooth and consistent?
  • is it some code/image optimization that we need to do on our end, OR is it simply related to G2.0?

I know there are some scrollView fixes coming.  I don’t know if this one is addressed or not. 

Rob

Thanks @Rob, that is really good news. Hopefully, the update will correct the issue.

Ok, I filed a bug report for this problem, case 30976.

Attached is the code to test with. There is nothing but a scrollView with 20 text items.

Although it happens in Simulator too, it happens more often & obvious in actual devices. Besides, with actual devices you can swipe faster & it’s how the end users operates.

Try to scroll up & down, sometimes go fast, try to bang on it.

You should be able to feel sometimes it’s just not that smooth & jumps a bit here and there.

I tried it in the sim and on my iPhone 5.  It seems pretty smooth to me.  Can you make a video?

Rob