|
Post by musicdeveloper on Jan 7, 2020 4:53:56 GMT
Hello, EnhancedScroller is generally working great in my app, and it's an awesome Asset! I have encountered a weird issue - I'm occasionally trying to programmatically select a row in the scroller, and I also need the scrollers to visually scroll to the selected row. I'm using the function JumpToDataIndex() to make sure the scrollers are scrolled to the proper location, showing the selected row. Unfortunately, this frequently results in cells disappearing. Screenshot is attached showing an instance where the top cells have disappeared. Is this a bug, or should I be using a different function to scroll to the selected index? Thank you, Peter
|
|
|
Post by echo17 on Jan 7, 2020 14:12:16 GMT
Sorry you are having trouble. I'm not sure what would be causing this. If you could put together a simple project demonstrating the issue, I can take a look and give you a diagnosis. The simpler the project the better. Please see this FAQ for more information: link
|
|
|
Post by musicdeveloper on Jan 8, 2020 22:21:12 GMT
Thanks for getting back to me.
I think I've resolved the issue by setting the scroll position using the ReloadData( [scrollPosition] ) function, instead of jumpToDataIndex().
I can see that the JumpToDataIndex() seems to work ok in the Sample Demo - so I don't know exactly what's causing the bug in my project. It does seem like buggy behavior in the framework though. I think it's happening when the scroller can't actually scroll to the designated scrollOffset - for instance, if you ask for scrollOffset of 0.25f, and ask to select row 4 out of 5.
I'm very tight on time, so I don't have time to try and recreate in a sample project at the moment - I think the ReloadData() function will work fine for now...
Thank you!
|
|
|
Post by meatloaf1024 on May 20, 2022 22:11:40 GMT
I'm having the exact same problem but with setting ScrollPosition after ReloadData() is called. Here is my code below
oldScrollPosition = enhancedScroller.ScrollPosition; this.friendListEntries = friendsListEntries; enhancedScroller.ReloadData(); enhancedScroller.ScrollPosition = oldScrollPosition;
After the below is called, it looks like the correct position is set but the incorrect cells are loaded when I look in the scene view. This means the area that is not masked out displays nothing).
As the other user mentioned if set the position utilizing ReloadData(normalizedPosition) there is no issue.
Was able to actually get my use case working using the following code.
oldScrollPosition = enhancedScroller.ScrollPosition; this.friendListEntries = friendsListEntries; enhancedScroller.ReloadData(); var normalizedScrollPosition = Mathf.Clamp(oldScrollPosition / enhancedScroller.ScrollSize, 0, 1); if (float.IsNaN(normalizedScrollPosition)) { normalizedScrollPosition = 0; } enhancedScroller.ReloadData(normalizedScrollPosition);
|
|
|
Post by dmitry on May 21, 2022 13:06:09 GMT
Same issue here, my solution is to set forceCalculateRange=true:
enhancedScroller.JumpToDataIndex( index, 0f, 0f, true, EnhancedScroller.TweenType.immediate, 0f, null, EnhancedScroller.LoopJumpDirectionEnum.Closest, true );
|
|