Phase 6 updates

Phase 6 · Slice 33 ·

Virtualized ListView

  • Collection views keep a pool of the viewport's worth of items plus two (fixed heights: the viewport over the item height; dynamic: over the smallest height measured), bound to the indices from the first in view; scrolling rebinds the items that leave to the indices that arrive (the others keep theirs) and orders them; the content's top padding stands for the items above and its height for all of them. Pool items past the end are hidden and unbound; items no longer needed are kept for reuse, and only Rebuild destroys them (destroyItem for every item made).
  • RefreshItems binds every item again and fits the pool to the source's count; changing fixedItemHeight refits the pool while the items made keep their height until a rebuild, as in Unity. ScrollToItem scrolls up to an item above, or down until it shows (one item further with fixed heights, as Unity's does); -1 is the last. GetRootElementForIndex is null out of view.
  • Dynamic heights: each index's measured height (the rest estimated by the average) places the rows, and a measurement refits the view in the same frame: panels now lay out again (up to five passes) while geometry callbacks change styles or layout, as Unity's do.
  • The default theme's collection items have no margins (labels as items sit edge to edge).
  • Checked by ui_toolkit_list_virtualization (6000.3): items made, the indices shown and their places, content size and padding, scrolling by offset and ScrollToItem (to an index and the end), GetRootElementForIndex, shrinking and growing the source, a new fixedItemHeight, Rebuild, indices bound and unbound at each step, and dynamic rows in view after scrolling.
  • Not yet: the exact order of binding calls (Unity's binds some items twice), dynamic heights' content-size estimate as Unity's computes it.
  • Next: TreeView; reorderable lists.