Page 1 of 1

sluggish scroller [Solved]

Posted: Sun Dec 20, 2015 11:07 am
by Jellobus
Hello

I always noticed when a native scroller is created and start to scroll, the first scrolling is not smooth and sluggish until the all contents (images, texts) are revealed. I tried

Code: Select all

on preOpenCard
  prepare image file "FILENAME of all content images"
end preOpenCard
but there was no performance improvement.. Is anyone know how to increase the performance of the scroller?

Re: sluggish scroller

Posted: Sun Dec 20, 2015 12:33 pm
by Dixie
On iOS or Android... ?
Would you like to post your code ?

Re: sluggish scroller

Posted: Sun Dec 20, 2015 4:10 pm
by Jellobus
Hi Dixie,
The issue found on Android.
The stack was originally built with LC 6.5.2. It was working fine back then but I found the scroller sluggish once the stack was deployed with the latest LC 6.7.8 (rc4).

the code is here.

Code: Select all

on preOpenStack
   set the acceleratedRendering of this stack to true
end preOpenStack

on setScroller
   if the environment is "mobile" then
      put the rect of group "Scroll" of this card into tScrollerRect
      put 0,0,400,2249 into tContentRect 
      mobileControlCreate "scroller", "GroupScroll"
      put the result into sScrollerID
      mobileControlSet "GroupScroll", "rect", tScrollerRect
      mobileControlSet "GroupScroll", "contentRect", tContentRect
      mobileControlSet "GroupScroll", "visible", true
      mobileControlSet "GroupScroll", "vIndicator", true
      mobileControlSet "GroupScroll", "vscroll", 0
   end if
end setScroller

on scrollerDidScroll hOffset, vOffset
   lock screen
   set the vScroll of group "Scroll" to vOffset
   unlock screen
end scrollerDidScroll

Re: sluggish scroller

Posted: Sun Dec 20, 2015 5:49 pm
by Dixie
Hi...

Your code looks fine to me... but you don't need to use 'lock screen' in your 'scrollerDidScroll' handler... taking out the 'lock screen' statements, does that make a difference ?, I think it should as this handler scrolls continually whilst scrolling...

dixie

Re: sluggish scroller

Posted: Mon Dec 21, 2015 2:31 am
by Jellobus
Hi Dixie,

I tried without lock screen but the result was same. The stack was originally built with LC 6.5.2 so I am thinking rebuild a complete replica of the current stack with the latest LC 6 or 7 version. Complete rebuilding can be just waste of time but I don't see many other options. :roll: I will let you know if there is any performance improvement. Thanks.

Louis

Re: sluggish scroller

Posted: Mon Dec 21, 2015 11:02 am
by Jellobus
Hi Dixie,

The issue has been fixed! :D I just set the resizeQuality of images in the scroller to "Good" from "best". Scrolling is very smooth and the image quality in "good" is not bad. Thanks for your advice.

Cheers,

Louis

Re: sluggish scroller [Solved]

Posted: Mon Dec 21, 2015 12:35 pm
by Klaus
...
set the resizeQuality of img 1 to "not bad"
...
I like that! :D