Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SectionList

An object which manages a collection of variable sized sections.

A section list is well suited to managing row heights in virtually scrolling list controls. In these controls, most rows are uniform height while a handful of rows are variable sized. A pair of lists can be used to efficiently manage a virtually scrolling data grid.

A section list has guaranteed O(log n) worst-case performance for most operations, where n is the number of variable sized sections.

Hierarchy

  • SectionList

Index

Properties

Accessors

Methods

Properties

Private _root

_root: ISpan

Accessors

count

  • get count(): number
  • Get the total number of sections in the list.

    Notes

    This operation has O(1) complexity.

    Returns number

size

  • get size(): number
  • Get the total size of all sections in the list.

    Notes

    This operation has O(1) complexity.

    Returns number

Methods

indexOf

  • indexOf(offset: number): number
  • Find the index of the section which covers the given offset.

    Parameters

    • offset: number

      The positive offset position of interest.

    Returns number

    The index of the section which covers the given offset, or -1 if the offset is out of range.

    Notes

    This operation has O(log n) complexity.

insert

  • insert(index: number, count: number, size: number): number
  • Insert new sections into the list.

    Parameters

    • index: number

      The index at which to insert the first section. This value is clamped to the bounds of the list.

    • count: number

      The number of sections to insert. This must be greater than zero.

    • size: number

      The size of each section. This value is clamped to a lower bound of 0.

    Returns number

    The index of the first inserted section, or -1 if the count is <= 0.

    Notes

    This operation has O(log n) complexity.

offsetOf

  • offsetOf(index: number): number
  • Find the offset position of the section at the given index.

    Parameters

    • index: number

      The index of the section of interest.

    Returns number

    The offset position of the section at the given index, or -1 if the index is out of range.

    Notes

    This operation has O(log n) complexity.

remove

  • remove(index: number, count: number): number
  • Remove existing sections from the list.

    Parameters

    • index: number

      The index of the first section to remove.

    • count: number

      The number of sections to remove. This must be greater than zero.

    Returns number

    The actual number of sections removed.

    Notes

    This operation has O(log n) complexity.

    Any sections which are out of range will be ignored.

resize

  • resize(index: number, count: number, size: number): number
  • Resize existing sections in the list.

    Parameters

    • index: number

      The index of the first section to resize.

    • count: number

      The number of sections to resize. This must be greater than zero.

    • size: number

      The new size of each section. This value is clamped to a lower bound of 0.

    Returns number

    The actual number of sections resized.

    Notes

    This operation has O(log n) complexity.

    Any sections which are out of range will be ignored.

sizeOf

  • sizeOf(index: number): number
  • Find the size of the section at the given index.

    Parameters

    • index: number

      The index of the section of interest.

    Returns number

    The size of the section at the given index, or -1 if the index is out of range.

    Notes

    This operation has O(log n) complexity.

Generated using TypeDoc