Skip to content

marvelous007x/LoopScroll

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LoopScrollView

Overview

This project implements an recyclable list by referencing ScrollRect source code and LoopScrollRect, with the goal of completely abandoning LayoutGroup components.

If element size is fixed, use LoopScrollFixed, you should set its size field, since it will ignore item's real size. Otherwise use LoopScrollFlex.

Use

  • Fill elements via calling RefillCells(int offset = 0) or RefillCellsBackwards(int index).

  • Listen to onRefreshItem to draw your elements.

  • Listen to onReleaseItem if you wish to get callback when element was released to cache pool.

  • Set totalCount negative for infinite items.

  • Set element size in onRefreshItem for dynamic case.

Dynamic Case Notes

  • Scrollbar may be a little jittering, since I need to update predicted total size for all elements and scrollbar value every time when element changes.

  • If you want element for auto size, functionally like ContentSizeFitterLayoutElment, please implement your own script to immediately resize RectTransform size in onRefreshItem invokes. Maybe like LayoutRebuilder.ForceRebuildLayoutImmediate.

  • Won't implement dynamic size loop grid case. If you need, just group several items together as a single item and use LoopScrollFlex.

Other Notes

  • Now it's simple and may lack lots of functions, but should be useable.

  • Probably will not implement for both directions since rare use cases.

  • Just padding of scroll moving direction is now not added, and probably will not afterwards.

  • DO NOT CHANGE element position along loop direction.

  • ScrollSensitivity in horizontal is negative of ScrollRect.ScrollSensitivity which applys to my habbit.

  • For auto expand view scrollbar, I just expand view size by its pivot. So set view anchor pivot properly if you use auto hide and expand viewport scrollbar.

  • enableDragInParent lets you to pass drag events to parents.For example, if you have loop horizontals in loop vertical, you can drag vertically for the vertical loop without affecting horizontals, and drag horizontally for a horizontal loop without affecting the vertical loop. Whether it's a horizontal or vertical drag is judged in OnBeginDrag by checking whick direction of dragged offset is larger.

  • Common layout field values MUST be set before called RefillCell, does not support changing when and after refilling items.

About

An implemention of recyclable scroll for unity ugui without LayoutGroup.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages