Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: nguiman on March 28, 2014, 11:41:48 PM

Title: Adjusting the 'Next Page Threshold'
Post by: nguiman on March 28, 2014, 11:41:48 PM
I have a scrollview with a number of items and I want to adjust the swipe delta required to progress to the next/previous item.

I tried increasing the UICenterOnChild::nextPageThreshold, but saw no change. I checked and it seems the index value it checks against is 0.

what else needs to be set?
Title: Re: Adjusting the 'Next Page Threshold'
Post by: ArenMook on March 29, 2014, 06:08:29 AM
Index value it checks against? Not sure what index you're referring to.

Next page threshold is all you need, but keep in mind that a "page" is just the next child. So if you have this:

CenterOnChild
- Item 1
- Item 2
- Item 3
- Item 4

...then it will just go to the next child. You need this instead:

CenterOnChild
- Page 1
-- Item 1
-- Item 2
- Page 2
-- Item 3
-- Item 4
Title: Re: Adjusting the 'Next Page Threshold'
Post by: nguiman on March 29, 2014, 03:21:08 PM
looking at the code for UICenterOnChild, I saw that it was checking whether 'index > 0' before calculating which page to go to. Obviously since my index is 0 it never runs.

how can I adjust the threshold in the first setup shown (simple list of unparented children items)? Thank you.
Title: Re: Adjusting the 'Next Page Threshold'
Post by: ArenMook on March 30, 2014, 07:14:37 AM
index > 0 check is there so that you don't go to a child with the index of -1. If your index is 0, then the code below would result in a child index of -1, which is obviously invalid.

You need to order it like I suggested, with pages. Otherwise the movement will take you to the next child, not the next page.
Title: Re: Adjusting the 'Next Page Threshold'
Post by: nguiman on March 30, 2014, 08:02:27 PM
Thanks as always for the confirmation.

I just checked and it appears the setup of the scrollview/grid items is similar to the latter.

But I'm still receiving a zero for the index and no result when adjusting the threshold.