com.unity.uiextensions icon indicating copy to clipboard operation
com.unity.uiextensions copied to clipboard

Infinite scroll refresh after reordering items in scroll snap control.

Open SimonDarksideJ opened this issue 2 years ago • 0 comments

Issue created by Peter Tkačov as Bitbucket Issue #​374 on 2021.05.16 19:57. Sometimes I want to reorder my items. I am doing it by reordering childrens by SettingSiblingIndexes of recttransforms and calling UpdateLayout to apply the change to scrollsnap. But now I need to also update the order of items in UI_InfiniteScroll object. Calling the SetNewItems method is not good for this case because it is destroying the existing childrens. Creating new items and destroying old one just to reorder is unnecessarily slow. Calling the Init again will unnecessarily calls all getcomponents again and then SetItems method does not clear the Items. My proposed fix of UI_InfiniteScroll is to add public access to SetItems method so you can update the list after reorder from outside and move items.Clear from SetNewItems to SetItems method where it should be anyway because if someone calls Init more then one time, you end up with items list with duplicate values.

SimonDarksideJ avatar Apr 26 '22 07:04 SimonDarksideJ