Rezi
    Preparing search index...

    Function ensureVisible

    • Ensure selected index is visible by adjusting scrollTop.

      If the item is above the viewport, scroll up to show it at the top. If the item is below the viewport, scroll down to show it at the bottom. If the item is already visible, return current scrollTop unchanged.

      Parameters

      • scrollTop: number

        Current scroll position

      • viewportHeight: number

        Visible viewport height

      • itemOffset: number

        Y offset of the item to make visible

      • itemHeight: number

        Height of the item to make visible

      Returns number

      Adjusted scrollTop to ensure item is visible