Describes the scrolling logic between the content and the container

Constructors

Properties

onReady: PublicApi<void> = ...
onScrollUpdate: PublicApi<ScrollViewEventArgs> = ...
onSnapUpdate: PublicApi<ScrollViewEventArgs> = ...

Accessors

  • get contentLength(): number
  • Returns number

    the content length along the Y-axis

  • set contentLength(length): void
  • Sets the true length of the content in the case of pooling / other non-default use cases

    Parameters

    • length: number

    Returns void

  • get contentPosition(): vec3
  • Returns vec3

    the content position in local space

  • set contentPosition(position): void
  • Sets the position of the content in local space

    Parameters

    Returns void

  • get enableScrollInertia(): boolean
  • Returns boolean

    if the ScrollView will continue scrolling on release

  • set enableScrollInertia(enableScrollInertia): void
  • Toggles if the ScrollView should continue scrolling on release

    Parameters

    • enableScrollInertia: boolean

    Returns void

  • get isReady(): boolean
  • Returns boolean

    if this class is ready to be used, which means that content is set

  • get overflow(): number
  • Returns number

  • get scrollLimit(): number
  • Returns number

    what amount of the scroll area should always be occupied

  • set scrollLimit(limit): void
  • Sets the amount of the scroll area should always be occupied

    Parameters

    • limit: number

    Returns void

  • get scrollLimitOffset(): Rect
  • Returns Rect

  • get scrollPercentage(): number
  • Returns number

Methods

  • Checks if both inputted content edges are fully visible in the ScrollArea.

    Parameters

    • xEdge: -1 | 0 | 1

      0 if not checking any x-axis edge, 1 for right edge, -1 for left edge.

    • yEdge: -1 | 0 | 1

      0 if not checking any y-axis edge, 1 for top edge, -1 for bottom edge.

    Returns boolean

  • Converts the offset (normalized -1 to 1) to local units relative to the ScrollView canvas.

    Parameters

    Returns Rect

  • Converts local units (-1 to 1) to parent units relative to the ScrollView canvas.

    Parameters

    Returns vec2

  • Recomputes content and scroll area boundaries

    Returns void

  • Resets the content origin for the purpose of calculating scrollPercentage. Assumes that the ScrollView is currently at the top of content in the pooling use case.

    Returns void

  • Scrolls content according to a drag vector, along the enabled axis

    Parameters

    • dragVector: vec2

      2D vector to move the content

    Returns void

  • Sets scroll content. Should be called only one time to initialize the content and binds to onStartEvent.

    Parameters

    Returns void

  • Snaps content to the selected edges

    Parameters

    Returns void