|
Post by letsketch on Jul 15, 2020 9:47:03 GMT
|
|
|
Post by echo17 on Jul 15, 2020 13:31:07 GMT
Sorry for the headache! Cell expansion requires a lot of math because the scroller deals in normalized positions which change when the overall size of the scroller changes during an expansion or collapse.
Fortunately, for the case that you show in the video, that is not relevant since the scroller size is not changing. The cells are expanding perpendicular to the scroller's direction which means you don't have to do all the crazy math to get the positioning correct after expansion / collapse.
For your case, there are a number of ways you can do this. My first thought would be to have your cell view structure like:
CellView |- expansion control |- image |- text |- etc
So the parent level cell view size is controlled by enhanced scroller. The expansion control is something you can set up as a child object, like maybe a panel. Then all your individual elements like text and images would be children of the expansion control. In your code, you can then control the size of the expansion control entirely within the cell view without having to do anything in the controller. Your tweening and input events would be inside the cell view.
One thing to keep in mind is that you should retain a reference to the underlying data that the cell view is using to populate itself, possibly caching it when you set the data. When the expansion / collapse happens, you'll need to update some property in your data (maybe a field called expanded which is a boolean). That way if the cell recycles, you can make sure you set the size of the cell correctly.
|
|
|
Post by letsketch on Jul 16, 2020 6:09:27 GMT
Thanks for the tips ... have refactored the prefab and iterated the Controller/Cell scripts. onClick is working for active cells .. but shit gets weird when the scroller moves beyond the current visible (active) cells. Notes here: donedone.to/ES.htmlVideo here: www.youtube.com/watch?v=bTShGjrO5zw&feature=youtu.beController GIST here: https://gist.github.com/jasonb202020/6e6234fdf0de1ac6a56a7929c29ded2d Cell GIST here: https://gist.github.com/jasonb202020/c57263a9131ab7bdc21cace0d67ed0ee Help!
|
|
|
Post by echo17 on Jul 16, 2020 13:07:49 GMT
If you could put together a simple project demonstrating the issue, I'll take a look for you. Just zip up the entire project so I don't have to recreate the example from your scripts (and possibly not get the same results). Please see this FAQ: link
|
|