LoopScrollRect icon indicating copy to clipboard operation
LoopScrollRect copied to clipboard

How to lock Infinite Scroll on some moment? Put the limit from start and end?

Open jasursadikov opened this issue 3 years ago • 4 comments

I want to display feed with thumbnails that are loaded from internet. Since feed has no particular limit, I want to use LoopScrollRect. But when I'm waiting for upcomming data to load, I want to stop scroll and limit the user until data is loaded. Is there any way to do that?

jasursadikov avatar May 16 '22 11:05 jasursadikov

Or nether, is it possible to place range there? Thank you!

jasursadikov avatar May 16 '22 14:05 jasursadikov

If you just want to freeze, there is a trick way: just add one additional bool mDisableDrag and check the variable in https://github.com/qiankanglai/LoopScrollRect/blob/78714f9fd2427753cd9e3dd0e50a449d2c7f2aa9/Runtime/LoopScrollRectBase.cs#L1385

if (!IsActive() || mDisableDrag)
    return;

If you need limit the range, you can just modify totalCount and call RefreshCells instead.

qiankanglai avatar May 17 '22 16:05 qiankanglai

Is it possible to keep 2 digits, like range? So index sent by element could be variated?

jasursadikov avatar May 24 '22 14:05 jasursadikov

Sorry for late reply. Do you mean strict the range like [mStart, mEnd] rather than [0, totalCount]?

It is possible but will break current API a lot, so I won't implement it till I find the way to keeping existing code work.

But there is a small trick that works: let totalCount=mEnd-mStart, and add offset index += mStart in LoopScrollPrefabSource when providing data.

qiankanglai avatar Jun 05 '22 07:06 qiankanglai